1{-# OPTIONS_GHC -Wall #-}
2module AST.Expression.Canonical
5 , Facts(..), dummyFacts
6 , SortedDefs(..), toSortedDefs
10import qualified AST.Expression.General as General
11import qualified AST.Pattern as Pattern
12import qualified AST.Type as Type
13import qualified AST.Variable as Var
14import qualified Reporting.Annotation as A
15import qualified Reporting.Region as R
18{-| Canonicalized expressions. All variables are fully resolved to the module
22 General.Expr R.Region Def Var.Canonical Type.Canonical
26 General.Expr' R.Region Def Var.Canonical Type.Canonical
30 = Def Facts Pattern.Canonical Expr (Maybe (A.Located Type.Canonical))
34 { dependencies :: [Var.TopLevel]
40 Facts (error "This should be set by Canonicalize.Sort")
49 | YesMain [Def] Def [Def]
52toSortedDefs :: Expr -> SortedDefs
53toSortedDefs (A.A _ expr) =
55 General.Let defs body ->
56 foldr defCons (toSortedDefs body) defs
62defCons :: Def -> SortedDefs -> SortedDefs
63defCons def@(Def _ (A.A _ pattern) _ _) sortedDefs =
64 case (pattern, sortedDefs) of
65 (Pattern.Var "main", NoMain defs) ->
71 (_, YesMain defs main rest) ->
72 YesMain (def : defs) main rest
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