@@ -11,8 +11,10 @@ import qualified AST.Type as Type
11import qualified Reporting.Annotation as A
11import qualified Reporting.Annotation as A
14-- DECLARATIONS
15-- DECLARATIONS
16data Declaration' port def tipe expr
18data Declaration' port def tipe expr
17 = Definition def
19 = Definition def
18 | Datatype String [String] [(String, [tipe])]
20 | Datatype String [String] [(String, [tipe])]
@@ -21,22 +23,26 @@ data Declaration' port def tipe expr
21 | Fixity Assoc Int String
23 | Fixity Assoc Int String
24-- INFIX STUFF
27-- INFIX STUFF
26data Assoc = L | N | R
30data Assoc = L | N | R
27 deriving (Eq)
31 deriving (Eq)
30assocToString :: Assoc -> String
34assocToString :: Assoc -> String
31assocToString assoc =
35assocToString assoc =
32− case assoc of
36+ case assoc of
33− L -> "left"
37+ L -> "left"
34− N -> "non"
38+ N -> "non"
35− R -> "right"
39+ R -> "right"
38-- DECLARATION PHASES
43-- DECLARATION PHASES
40type SourceDecl' =
46type SourceDecl' =
41 Declaration' SourcePort Source.Def Type.Raw Source.Expr
47 Declaration' SourcePort Source.Def Type.Raw Source.Expr
@@ -54,8 +60,10 @@ type CanonicalDecl =
54 A.Commented (Declaration' CanonicalPort Canonical.Def Type.Canonical Canonical.Expr)
60 A.Commented (Declaration' CanonicalPort Canonical.Def Type.Canonical Canonical.Expr)
59data SourcePort
67data SourcePort
60 = PortAnnotation String Type.Raw
68 = PortAnnotation String Type.Raw
61 | PortDefinition String Source.Expr
69 | PortDefinition String Source.Expr
@@ -77,8 +85,10 @@ validPortName port =
77 Out name _ _ -> name
85 Out name _ _ -> name
80-- BINARY CONVERSION
89-- BINARY CONVERSION
82instance Binary Assoc where
92instance Binary Assoc where
84 do n <- getWord8
94 do n <- getWord8