1module Type.Environment where
3import qualified Data.Map as Map
5import qualified Data.UnionFind.IO as UF
9data Environment = Environment {
10 constructor :: Map.Map String ([Variable], Type),
11 builtin :: Map.Map String Type,
12 value :: Map.Map String Type
15initialEnvironment :: IO Environment
16initialEnvironment = do
17 let mkPair name = fmap ((,) name . VarN) (namedVar name)
20 prims <- mapM mkPair ["Float","Char","Bool","Element"]
21 let builtins = list : int : prims
23 cons <- do v <- flexibleVar
24 let vlist = TermN (App1 (snd list) (VarN v))
25 return ([v], VarN v ==> vlist ==> vlist)
27 nil <- do v <- flexibleVar
28 return ([v], TermN (App1 (snd list) (VarN v)))
30 let add = snd int ==> snd int ==> snd int
32 return $ Environment {
33 constructor = Map.fromList [("::", cons), ("[]", nil)],
34 builtin = Map.fromList builtins,
35 value = Map.empty -- Map.fromList [("+", add)]
38get :: Environment -> (Environment -> Map.Map String a) -> String -> a
39get env subDict key = Map.findWithDefault err key (subDict env)
41 err = error $ "Could not find '" ++ key ++ "' in the type environment."
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