//we have to cheat to decorate the error, can be done nicer?
unify t e = StateT $ \s0 -> let res = runStateT m s0 in case res of
Left err = Left $ decErr e err
Right t = Right t //note, t :: (Type, Gamma)
where m = typeExpr e >>= \tex-> unify t tex
//we have to cheat to decorate the error, can be done nicer?
unify t e = StateT $ \s0 -> let res = runStateT m s0 in case res of
Left err = Left $ decErr e err
Right t = Right t //note, t :: (Type, Gamma)
where m = typeExpr e >>= \tex-> unify t tex