-algW :: HMTerm -> Either String TypeScheme
-algW (HMTerm (Var _) t) = Right t
-algW (HMTerm (Lambda x t) (TScheme p)) = do
- let v = TScheme (TypeVar fresh)
- np = substitute v x t
- unify p np
-algW (HMTerm (App u v) t) = do
- tu <- algW u
- tv <- algW v
- case tu of
- (TScheme (TypeFunction a b)) -> do
- unify a tv
- return b
- _ -> Left $ "cannot apply " ++ show tu ++ " to " ++ show tv
+algW :: TypedTerm -> Either String TypeScheme
+algW (TTerm (Var _) t) = Right t
+--algW (TTerm (Lam x t) (TScheme p)) = do
+-- let v = TScheme (TypeVar fresh)
+-- np = substitute v x t
+-- unify p np
+--algW (TTerm (App u v) t) = do
+-- tu <- algW u
+-- tv <- algW v
+-- case tu of
+-- (TScheme (TypeFunction a b)) -> do
+-- unify a tv
+-- return b
+-- _ -> Left $ "cannot apply " ++ show tu ++ " to " ++ show tv