1module Transform.Interface (filterExports) where
3import qualified Data.Map as Map
4import qualified Data.Maybe as Maybe
5import qualified AST.Module as Module
6import qualified AST.Variable as Var
9filterExports :: Module.Interface -> Module.Interface
10filterExports interface =
15 (get (Module.iTypes interface))
16 (Var.getValues exports ++ ctors)
21 (get (Module.iAliases interface))
22 (Var.getAliases exports)
26 (Maybe.mapMaybe (trimUnions interface) unions)
29 exports :: [Var.Value]
31 Module.iExports interface
33 unions :: [(String, Var.Listing String)]
39 concatMap (\(_, Var.Listing ctorList _) -> ctorList) unions
42get :: Map.Map String a -> String -> Maybe (String, a)
44 case Map.lookup key dict of
46 Just value -> Just (key, value)
51 -> (String, Var.Listing String)
52 -> Maybe (String, Module.AdtInfo String)
53trimUnions interface (name, Var.Listing exportedCtors _) =
54 case Map.lookup name (Module.iAdts interface) of
56 Just (tvars, ctors) ->
57 let isExported (ctor, _) =
58 ctor `elem` exportedCtors
60 Just (name, (tvars, filter isExported ctors))
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