diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-02-13 20:55:24 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-02-13 20:55:24 +0100 |
commit | 2886ae5ba8addbb86a3fad52ccc65b3309e12fcd (patch) | |
tree | c92a9654e9597c43b51402176d46fcdc5bf332d3 /AST.hs | |
parent | 4eaad85056c7cbea2ece4ac3867dec1f7403ac33 (diff) |
Cleanup
Diffstat (limited to 'AST.hs')
-rw-r--r-- | AST.hs | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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) |