43 lines
904 B
Haskell
43 lines
904 B
Haskell
module IR where
|
|
|
|
type Param = (Text, IRExpr)
|
|
|
|
data IRExpr
|
|
= Var {varName :: Text}
|
|
| Level {level :: Integer}
|
|
| App
|
|
{ appFunc :: IRExpr
|
|
, appArg :: IRExpr
|
|
}
|
|
| Abs
|
|
{ absParamName :: Text
|
|
, absParamType :: IRExpr
|
|
, absAscription :: Maybe IRExpr
|
|
, absBody :: IRExpr
|
|
}
|
|
| Pi
|
|
{ piParamName :: Text
|
|
, piParamType :: IRExpr
|
|
, piAscription :: Maybe IRExpr
|
|
, piBody :: IRExpr
|
|
}
|
|
| Let
|
|
{ letVarName :: Text
|
|
, letAscription :: Maybe IRExpr
|
|
, letValue :: IRExpr
|
|
, letBody :: IRExpr
|
|
}
|
|
deriving (Show, Eq, Ord)
|
|
|
|
data IRDef
|
|
= Def
|
|
{ defName :: Text
|
|
, defAscription :: Maybe IRExpr
|
|
, defBody :: IRExpr
|
|
}
|
|
| Axiom
|
|
{ axiomName :: Text
|
|
, axiomAscription :: IRExpr
|
|
}
|
|
|
|
type IRProgram = [IRDef]
|