2module Transform.Interface (filterExports) where
4import qualified Data.Map as Map
5import qualified AST.Module as Module
6import qualified AST.Type as Type
7import qualified AST.Variable as Var
9filterExports :: Module.Interface -> Module.Interface
10filterExports interface =
13 Map.fromList (concatMap getTypes exportedValues)
15 Map.fromList (concatMap getAliases exportedValues)
17 Map.fromList (concatMap getAdts exportedValues)
20 exportedValues :: [Var.Value]
21 exportedValues = Module.iExports interface
23 get :: Map.Map String a -> String -> [(String, a)]
25 case Map.lookup x dict of
29 getTypes :: Var.Value -> [(String, Type.CanonicalType)]
32 Var.Value x -> getType x
34 Var.ADT _ (Var.Listing ctors _) -> concatMap getType ctors
36 getType :: String -> [(String, Type.CanonicalType)]
38 get (Module.iTypes interface) name
40 getAliases :: Var.Value -> [(String, ([String], Type.CanonicalType))]
44 Var.Alias name -> get (Module.iAliases interface) name
47 getAdts :: Var.Value -> [(String, Module.AdtInfo String)]
52 Var.ADT name (Var.Listing exportedCtors _) ->
53 case Map.lookup name (Module.iAdts interface) of
55 Just (tvars, ctors) ->
56 [(name, (tvars, filter isExported ctors))]
58 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