1{-# OPTIONS_GHC -Wall #-}
2module AST.Declaration where
6import qualified AST.Expression.Canonical as Canonical
7import qualified AST.Expression.Source as Src
8import qualified AST.Type as Type
9import qualified Reporting.Annotation as A
17 CommentOr (A.Located Raw)
21 = Comment (A.Located String)
27 | Union (Union Type.Raw)
28 | Alias (Alias Type.Raw)
30 | Port String Type.Raw
34-- STRUCTURED DECLARATIONS
39 { _defs :: [A.Commented def]
40 , _unions :: [A.Commented (Union tipe)]
41 , _aliases :: [A.Commented (Alias tipe)]
47 Decls Src.ValidDef Type.Raw
51 Decls Canonical.Def Type.Canonical
54addDef :: A.Commented d -> Decls d t -> Decls d t
56 decls { _defs = def : _defs decls }
59addUnion :: A.Commented (Union t) -> Decls d t -> Decls d t
61 decls { _unions = union : _unions decls }
64addAlias :: A.Commented (Alias t) -> Decls d t -> Decls d t
66 decls { _aliases = alias : _aliases decls }
69addInfix :: Infix -> Decls d t -> Decls d t
70addInfix fixity decls =
71 decls { _infixes = fixity : _infixes decls }
87 Type [(String, [tipe])]
101 , _associativity :: Assoc
106data Assoc = L | N | R
110assocToString :: Assoc -> String
127instance Binary Infix where
129 Infix <$> get <*> get <*> get
131 put (Infix op assoc prec) =
137instance Binary Assoc where
144 _ -> 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