aboutsummaryrefslogtreecommitdiff
path: root/AST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AST.hs')
-rw-r--r--AST.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/AST.hs b/AST.hs
index cae9ecb..2e1bb13 100644
--- a/AST.hs
+++ b/AST.hs
@@ -1,14 +1,19 @@
module AST where
+import Data.List.NonEmpty (NonEmpty)
+
+
+newtype Name = Name String
+ deriving (Show, Eq)
data Program t = Program [FunDef t]
deriving (Show)
-data FunDef t = FunDef Name (Maybe Type) [FunEq t]
+data FunDef t = FunDef Name (Maybe Type) (NonEmpty (FunEq t))
deriving (Show)
-newtype Name = Name String
- deriving (Show, Eq)
+data FunEq t = FunEq Name [Pattern t] (RHS t)
+ deriving (Show)
data Type
= TApp Type [Type]
@@ -19,9 +24,6 @@ data Type
| TVar Name
deriving (Show)
-data FunEq t = FunEq Name [Pattern t] (RHS t)
- deriving (Show)
-
data Pattern t
= PWildcard t
| PVar t Name
@@ -32,7 +34,7 @@ data Pattern t
deriving (Show)
data RHS t
- = Guarded [(Expr t, Expr t)]
+ = Guarded [(Expr t, Expr t)] -- currently not parsed
| Plain (Expr t)
deriving (Show)