1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module AST.Declaration where
5import Prelude hiding (Either(..))
6import Control.Monad (liftM3)
10import qualified AST.Expression.Canonical as Canonical
11import qualified AST.Expression.Source as Src
12import qualified AST.Type as Type
13import qualified Reporting.Annotation as A
21 CommentOr (A.Located Raw)
25 = Comment (A.Located Text)
31 | Union (Union Type.Raw)
32 | Alias (Alias Type.Raw)
38-- STRUCTURED DECLARATIONS
43 { _defs :: [A.Commented def]
44 , _unions :: [A.Commented (Union tipe)]
45 , _aliases :: [A.Commented (Alias tipe)]
51 Decls Src.ValidDef Type.Raw
55 Decls Canonical.Def Type.Canonical
58addDef :: A.Commented d -> Decls d t -> Decls d t
60 decls { _defs = def : _defs decls }
63addUnion :: A.Commented (Union t) -> Decls d t -> Decls d t
65 decls { _unions = union : _unions decls }
68addAlias :: A.Commented (Alias t) -> Decls d t -> Decls d t
70 decls { _aliases = alias : _aliases decls }
73addInfix :: Infix -> Decls d t -> Decls d t
74addInfix fixity decls =
75 decls { _infixes = fixity : _infixes decls }
105 , _associativity :: Assoc
110data Assoc = Left | Non | Right
114defaultAssociativity :: Assoc
115defaultAssociativity =
119defaultPrecedence :: Int
124assocToText :: Assoc -> Text
141instance Binary Infix where
143 liftM3 Infix get get get
145 put (Infix op assoc prec) =
151instance Binary Assoc where
159 _ -> 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