@@ -15,11 +15,15 @@ declaration =
15 typeDecl <|> infixDecl <|> port <|> definition
15 typeDecl <|> infixDecl <|> port <|> definition
18+-- TYPE ANNOTATIONS and DEFINITIONS
18definition :: IParser D.SourceDecl
20definition :: IParser D.SourceDecl
19definition =
21definition =
20 D.Definition <$> (Expr.typeAnnotation <|> Expr.definition)
22 D.Definition <$> (Expr.typeAnnotation <|> Expr.definition)
25+-- TYPE ALIAS and UNION TYPES
23typeDecl :: IParser D.SourceDecl
27typeDecl :: IParser D.SourceDecl
25 do try (reserved "type") <?> "type declaration"
29 do try (reserved "type") <?> "type declaration"
@@ -40,6 +44,8 @@ typeDecl =
40 return $ D.Datatype name args tcs
44 return $ D.Datatype name args tcs
43infixDecl :: IParser D.SourceDecl
49infixDecl :: IParser D.SourceDecl
44infixDecl =
50infixDecl =
45 do assoc <-
51 do assoc <-
@@ -54,6 +60,8 @@ infixDecl =
54 D.Fixity assoc (read [n]) <$> anyOp
60 D.Fixity assoc (read [n]) <$> anyOp
57port :: IParser D.SourceDecl
65port :: IParser D.SourceDecl
59 do try (reserved "port")
67 do try (reserved "port")