1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module AST.Declaration where
8import qualified AST.Expression.Canonical as Canonical
9import qualified AST.Expression.Source as Src
10import qualified AST.Type as Type
11import qualified Reporting.Annotation as A
19 CommentOr (A.Located Raw)
23 = Comment (A.Located Text)
29 | Union (Union Type.Raw)
30 | Alias (Alias Type.Raw)
36-- STRUCTURED DECLARATIONS
41 { _defs :: [A.Commented def]
42 , _unions :: [A.Commented (Union tipe)]
43 , _aliases :: [A.Commented (Alias tipe)]
49 Decls Src.ValidDef Type.Raw
53 Decls Canonical.Def Type.Canonical
56addDef :: A.Commented d -> Decls d t -> Decls d t
58 decls { _defs = def : _defs decls }
61addUnion :: A.Commented (Union t) -> Decls d t -> Decls d t
63 decls { _unions = union : _unions decls }
66addAlias :: A.Commented (Alias t) -> Decls d t -> Decls d t
68 decls { _aliases = alias : _aliases decls }
71addInfix :: Infix -> Decls d t -> Decls d t
72addInfix fixity decls =
73 decls { _infixes = fixity : _infixes decls }
103 , _associativity :: Assoc
108data Assoc = L | N | R
112assocToText :: Assoc -> Text
129instance Binary Infix where
131 Infix <$> get <*> get <*> get
133 put (Infix op assoc prec) =
139instance Binary Assoc where
146 _ -> 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