1module Type.Inference where
3import qualified Data.Map as Map
5import qualified Type.Type as T
6import qualified Type.Environment as Env
7import qualified Type.Constrain.Expression as TcExpr
8import qualified Type.Constrain.Declaration as TcDecl
9import qualified Type.Solve as Solve
11import SourceSyntax.Module
12import Text.PrettyPrint
13import qualified Type.State as TS
14import Control.Monad.State
15import Transform.SortDefinitions as Sort
18infer :: Module t v -> IO (Either [Doc] (Map.Map String T.Variable))
19infer (Module _ _ _ decls) = do
20 env <- Env.initialEnvironment
22 let expr = sortDefs (TcDecl.toExpr decls)
23 constraint <- TcExpr.constrain env expr (T.VarN var)
24 (env,_,_,errors) <- execStateT (Solve.solve constraint) TS.initialState
26 then return $ Right env
27 else Left `fmap` sequence errors
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list