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
17import System.IO.Unsafe -- Possible to switch over to the ST monad instead of
18 -- the IO monad. Not sure if that'd be worthwhile.
20infer :: Module t v -> Either [Doc] (Map.Map String T.Variable)
21infer (Module _ _ _ decls) = unsafePerformIO $ do
22 env <- Env.initialEnvironment
24 let expr = sortDefs (TcDecl.toExpr decls)
25 constraint <- TcExpr.constrain env expr (T.VarN var)
26 (env,_,_,errors) <- execStateT (Solve.solve constraint) TS.initialState
28 then return $ Right env
29 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