1module Transform.Interface (filterExports) where
3import qualified Data.Map as Map
4import qualified AST.Module as Module
5import qualified AST.Type as Type
6import qualified AST.Variable as Var
8filterExports :: Module.Interface -> Module.Interface
9filterExports interface =
12 Map.fromList (concatMap getTypes exportedValues)
14 Map.fromList (concatMap getAliases exportedValues)
16 Map.fromList (concatMap getAdts exportedValues)
19 exportedValues :: [Var.Value]
20 exportedValues = Module.iExports interface
22 get :: Map.Map String a -> String -> [(String, a)]
24 case Map.lookup x dict of
28 getTypes :: Var.Value -> [(String, Type.CanonicalType)]
31 Var.Value x -> getType x
33 Var.Union _ (Var.Listing ctors _) -> concatMap getType ctors
35 getType :: String -> [(String, Type.CanonicalType)]
37 get (Module.iTypes interface) name
39 getAliases :: Var.Value -> [(String, ([String], Type.CanonicalType))]
43 Var.Alias name -> get (Module.iAliases interface) name
46 getAdts :: Var.Value -> [(String, Module.AdtInfo String)]
51 Var.Union name (Var.Listing exportedCtors _) ->
52 case Map.lookup name (Module.iAdts interface) of
54 Just (tvars, ctors) ->
55 [(name, (tvars, filter isExported ctors))]
57 isExported (ctor, _) = ctor `elem` exportedCtors
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