1{-# OPTIONS_GHC -Wall #-}
2module AST.Declaration where
6import qualified AST.Expression.Source as Source
7import qualified AST.Expression.Valid as Valid
8import qualified AST.Expression.Canonical as Canonical
9import qualified AST.Type as Type
10import qualified Reporting.Annotation as A
18 CommentOr (A.Located Raw)
22 = Comment (A.Located String)
28 | Union (Union Type.Raw)
29 | Alias (Alias Type.Raw)
31 | Foreign String Type.Raw
35-- STRUCTURED DECLARATIONS
40 { _defs :: [A.Commented def]
41 , _unions :: [A.Commented (Union tipe)]
42 , _aliases :: [A.Commented (Alias tipe)]
48 Decls Valid.Def Type.Raw
52 Decls Canonical.Def Type.Canonical
55addDef :: A.Commented d -> Decls d t -> Decls d t
57 decls { _defs = def : _defs decls }
60addUnion :: A.Commented (Union t) -> Decls d t -> Decls d t
62 decls { _unions = union : _unions decls }
65addAlias :: A.Commented (Alias t) -> Decls d t -> Decls d t
67 decls { _aliases = alias : _aliases decls }
70addInfix :: Infix -> Decls d t -> Decls d t
71addInfix fixity decls =
72 decls { _infixes = fixity : _infixes decls }
88 Type [(String, [tipe])]
102 , _associativity :: Assoc
107data Assoc = L | N | R
111assocToString :: Assoc -> String
128instance Binary Infix where
130 Infix <$> get <*> get <*> get
132 put (Infix op assoc prec) =
138instance Binary Assoc where
145 _ -> error "Error reading valid associativity from serialized string"
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