This commit is contained in:
crumbtoo
2023-12-17 15:23:09 -07:00
parent 20c936f317
commit 78f88e085f
4 changed files with 127 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ module Core.Syntax
, Type(..)
, Lit(..)
, pattern (:$)
, pattern (:@)
, pattern (:->)
, Binding(..)
, AltCon(..)
, pattern (:=)
@@ -57,15 +59,23 @@ data Type = TyInt
| TyFun
| TyVar Name
| TyApp Type Type
| TyConApp TyCon [Type]
-- | TyConApp TyCon [Type]
deriving (Show, Read, Lift, Eq)
type TyCon = Name
infixl 2 :$
pattern (:$) :: Expr b -> Expr b -> Expr b
pattern (:$) :: Expr b -> Expr b -> Expr b
pattern f :$ x = App f x
infixl 2 :@
pattern (:@) :: Type -> Type -> Type
pattern f :@ x = TyApp f x
infixr 1 :->
pattern (:->) :: Type -> Type -> Type
pattern a :-> b = TyApp (TyApp TyFun a) b
{-# COMPLETE Binding :: Binding #-}
{-# COMPLETE (:=) :: Binding #-}
data Binding b = Binding b (Expr b)