1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.BindingGroups
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
15module Language.PureScript.BindingGroups (
20import Data.List (intersect)
22import Language.PureScript.Declarations
23import Language.PureScript.Names
24import Language.PureScript.Scope (usedNames)
26createBindingGroups :: [Declaration] -> [Declaration]
27createBindingGroups ds =
29 values = filter isValueDecl ds
30 nonValues = filter (not . isValueDecl) ds
31 allIdents = map getIdent values
32 verts = map (\d -> (d, getIdent d, usedNames d `intersect` allIdents)) values
33 sorted = map toBindingGroup $ stronglyConnComp verts
35 map handleModuleDeclaration nonValues ++ sorted
37 isValueDecl :: Declaration -> Bool
38 isValueDecl (ValueDeclaration _ _ _ _) = True
40 getIdent :: Declaration -> Ident
41 getIdent (ValueDeclaration ident _ _ _) = ident
42 getIdent _ = error "undefined"
43 toBindingGroup :: SCC Declaration -> Declaration
44 toBindingGroup (AcyclicSCC d) = d
45 toBindingGroup (CyclicSCC [d]) = d
46 toBindingGroup (CyclicSCC ds') = BindingGroupDeclaration ds'
47 handleModuleDeclaration :: Declaration -> Declaration
48 handleModuleDeclaration (ModuleDeclaration name ds') = ModuleDeclaration name $ createBindingGroups ds'
49 handleModuleDeclaration other = other
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