1{-# OPTIONS_GHC -Wall #-}
2module AST.Expression.Source
3 ( RawExpr, RawExpr', RawDef, RawDef'(..)
4 , ValidExpr, ValidExpr', ValidDef(..)
6 , var, tuple, zero, getPattern, collectLambdas
10import qualified Data.Text as Text
11import Data.Text (Text)
13import qualified AST.Literal as Literal
14import qualified AST.Pattern as Ptrn
15import qualified AST.Type as Type
16import qualified AST.Variable as Var
17import qualified Reporting.Annotation as A
18import qualified Reporting.Region as R
30 = Literal Literal.Literal
33 | Binop [(Expr def, A.Located Text)] (Expr def)
34 | Lambda Ptrn.Raw (Expr def)
35 | App (Expr def) (Expr def)
36 | If [(Expr def, Expr def)] (Expr def)
37 | Let [def] (Expr def)
38 | Case (Expr def) [(Ptrn.Raw, Expr def)]
39 | Ctor Text [Expr def]
40 | Access (Expr def) Text
41 | Update (Expr def) [(A.Located Text, Expr def)]
42 | Record [(A.Located Text, Expr def)]
43 | GLShader Text Text Literal.Shader
46type RawExpr = Expr RawDef
48type RawExpr' = Expr' RawDef
50type ValidExpr = Expr ValidDef
52type ValidExpr' = Expr' ValidDef
64 = Definition Ptrn.Raw RawExpr
65 | Annotation Text Type.Raw
69 Def R.Region Ptrn.Raw ValidExpr (Maybe Type.Raw)
76var :: Text -> Expr' def
81tuple :: [Expr def] -> Expr' def
83 Ctor (Text.pack ("_Tuple" ++ show (length expressions))) expressions
88 Literal (Literal.IntNum 0)
91getPattern :: ValidDef -> Ptrn.Raw
92getPattern (Def _ pattern _ _) =
96collectLambdas :: Expr def -> ([Ptrn.Raw], Expr def)
97collectLambdas lexpr@(A.A _ expr) =
99 Lambda pattern body ->
101 (ps, body') = collectLambdas body
103 (pattern : ps, body')
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