2024-11-30 20:34:09 -08:00
|
|
|
module IR where
|
|
|
|
|
|
|
|
|
|
type Param = (Text, IRExpr)
|
|
|
|
|
|
|
|
|
|
data IRExpr
|
2024-11-30 22:36:27 -08:00
|
|
|
= Var {varName :: Text}
|
2024-12-02 20:39:56 -08:00
|
|
|
| Star
|
2024-11-30 22:36:27 -08:00
|
|
|
| Level {level :: Integer}
|
2024-11-30 20:34:09 -08:00
|
|
|
| App
|
2024-11-30 22:36:27 -08:00
|
|
|
{ appFunc :: IRExpr
|
|
|
|
|
, appArg :: IRExpr
|
2024-11-30 20:34:09 -08:00
|
|
|
}
|
|
|
|
|
| Abs
|
2024-11-30 22:36:27 -08:00
|
|
|
{ absParamName :: Text
|
|
|
|
|
, absParamType :: IRExpr
|
2024-12-01 21:43:15 -08:00
|
|
|
, absAscription :: Maybe IRExpr
|
2024-11-30 22:36:27 -08:00
|
|
|
, absBody :: IRExpr
|
2024-11-30 20:34:09 -08:00
|
|
|
}
|
|
|
|
|
| Pi
|
2024-11-30 22:36:27 -08:00
|
|
|
{ piParamName :: Text
|
|
|
|
|
, piParamType :: IRExpr
|
2024-12-01 21:43:15 -08:00
|
|
|
, piAscription :: Maybe IRExpr
|
2024-11-30 22:36:27 -08:00
|
|
|
, piBody :: IRExpr
|
2024-11-30 20:34:09 -08:00
|
|
|
}
|
|
|
|
|
| Let
|
2024-11-30 22:36:27 -08:00
|
|
|
{ letVarName :: Text
|
|
|
|
|
, letAscription :: Maybe IRExpr
|
|
|
|
|
, letValue :: IRExpr
|
|
|
|
|
, letBody :: IRExpr
|
2024-11-30 20:34:09 -08:00
|
|
|
}
|
|
|
|
|
deriving (Show, Eq, Ord)
|
|
|
|
|
|
2024-11-30 21:05:07 -08:00
|
|
|
data IRDef
|
|
|
|
|
= Def
|
2024-11-30 22:36:27 -08:00
|
|
|
{ defName :: Text
|
|
|
|
|
, defAscription :: Maybe IRExpr
|
|
|
|
|
, defBody :: IRExpr
|
2024-11-30 21:05:07 -08:00
|
|
|
}
|
|
|
|
|
| Axiom
|
2024-11-30 22:36:27 -08:00
|
|
|
{ axiomName :: Text
|
|
|
|
|
, axiomAscription :: IRExpr
|
2024-11-30 21:05:07 -08:00
|
|
|
}
|
2024-11-30 20:34:09 -08:00
|
|
|
|
|
|
|
|
type IRProgram = [IRDef]
|