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 qualified SourceSyntax.Expression as Expr
13import Text.PrettyPrint
14import qualified Type.State as TS
15import Control.Monad.State
16import Transform.SortDefinitions as Sort
18import System.IO.Unsafe -- Possible to switch over to the ST monad instead of
19 -- the IO monad. Not sure if that'd be worthwhile.
21infer :: MetadataModule t v -> Either [Doc] (Map.Map String T.Variable)
22infer modul = unsafePerformIO $ do
23 env <- Env.initialEnvironment
25 let expr = Expr.dummyLet $ defs modul
26 constraint <- TcExpr.constrain env expr (T.VarN var)
27 (env,_,_,errors) <- execStateT (Solve.solve constraint) TS.initialState
29 then return $ Right env
30 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