:: Gamma :== 'Map'.Map String Type
:: Env a :== StateT Gamma (Either SemError) a
+//we need to redefine this even though it is in Control.Monad.State
+instance MonadTrans (StateT Gamma) where
+ liftT m = StateT \s-> m >>= \a-> return (a, s)
+
get = gets id
instance toString SemError where
toString t1, ". Given: ", toString t2]
putIdent :: String Type -> Env Void
-putIdent i t = undef
-/*putIdent i t = gets ('Map'.get i) >>= \mt -> case mt of
- Nothing = pure <$> modify ('Map'.put i t)
- Just t2 = unify t t2 >>= \r -> case r of
- Left e = pure $ Left e
- Right t3 = pure <$> modify ('Map'.put i t3)*/
+putIdent i t = gets ('Map'.get i) >>= \mt -> case mt of
+ Nothing = modify ('Map'.put i t)
+ Just t2 = unify t t2 >>= \t3-> modify ('Map'.put i t3)
sem :: AST -> SemOutput
sem (AST vd fd) = case evalStateT m 'Map'.newMap of