comparison src/mono_env.sml @ 808:d8f58d488cfb

Mutual datatypes through Pathcheck
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 May 2009 15:55:15 -0400
parents e92cfac1608f
children b2311dfb3158
comparison
equal deleted inserted replaced
807:61a1f5c5ae2c 808:d8f58d488cfb
107 NONE => raise UnboundNamed n 107 NONE => raise UnboundNamed n
108 | SOME x => x 108 | SOME x => x
109 109
110 fun declBinds env (d, loc) = 110 fun declBinds env (d, loc) =
111 case d of 111 case d of
112 DDatatype (x, n, xncs) => 112 DDatatype dts =>
113 let 113 foldl (fn ((x, n, xncs), env) =>
114 val env = pushDatatype env x n xncs 114 let
115 val dt = (TDatatype (n, ref (ElabUtil.classifyDatatype xncs, xncs)), loc) 115 val env = pushDatatype env x n xncs
116 in 116 val dt = (TDatatype (n, ref (ElabUtil.classifyDatatype xncs, xncs)), loc)
117 foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt NONE "" 117 in
118 | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc) NONE "") 118 foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt NONE ""
119 env xncs 119 | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc) NONE "")
120 end 120 env xncs
121 end) env dts
121 | DVal (x, n, t, e, s) => pushENamed env x n t (SOME e) s 122 | DVal (x, n, t, e, s) => pushENamed env x n t (SOME e) s
122 | DValRec vis => foldl (fn ((x, n, t, e, s), env) => pushENamed env x n t NONE s) env vis 123 | DValRec vis => foldl (fn ((x, n, t, e, s), env) => pushENamed env x n t NONE s) env vis
123 | DExport _ => env 124 | DExport _ => env
124 | DTable _ => env 125 | DTable _ => env
125 | DSequence _ => env 126 | DSequence _ => env