comparison src/mono_env.sml @ 164:6847741e1f5f

Datatypes through monoize
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 13:32:07 -0400
parents 76a4d69719d8
children 25b169416ea8
comparison
equal deleted inserted replaced
163:80192edca30d 164:6847741e1f5f
79 fun lookupENamed (env : env) n = 79 fun lookupENamed (env : env) n =
80 case IM.find (#namedE env, n) of 80 case IM.find (#namedE env, n) of
81 NONE => raise UnboundNamed n 81 NONE => raise UnboundNamed n
82 | SOME x => x 82 | SOME x => x
83 83
84 fun declBinds env (d, _) = 84 fun declBinds env (d, loc) =
85 case d of 85 case d of
86 DVal (x, n, t, e, s) => pushENamed env x n t (SOME e) s 86 DDatatype (x, n, xncs) =>
87 let
88 val env = pushTNamed env x n NONE
89 in
90 foldl (fn ((x', n', NONE), env) => pushENamed env x' n' (TNamed n, loc) NONE ""
91 | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, (TNamed n, loc)), loc) NONE "")
92 env xncs
93 end
94 | DVal (x, n, t, e, s) => pushENamed env x n t (SOME e) s
87 | DValRec vis => foldl (fn ((x, n, t, e, s), env) => pushENamed env x n t NONE s) env vis 95 | DValRec vis => foldl (fn ((x, n, t, e, s), env) => pushENamed env x n t NONE s) env vis
88 | DExport _ => env 96 | DExport _ => env
89 97
90 end 98 end