- dataParameters :: QName -> Compile TCM Nat
- dataParametersTCM :: QName -> TCM Nat
- piApplyM' :: Type -> Args -> TCM Type
- insertTele :: (QName, Args) -> Int -> Maybe Type -> Term -> Telescope -> Compile TCM (Telescope, (Telescope, Type, Type))
- unifyI :: Telescope -> [Nat] -> Type -> Args -> Args -> Compile TCM [Maybe Term]
- remForced :: [Fun] -> Compile TCM [Fun]
- forcedExpr :: [Var] -> Telescope -> Expr -> Compile TCM Expr
- replaceForced :: ([Var], [Var]) -> Telescope -> [Var] -> [Maybe Term] -> Expr -> Compile TCM Expr
- buildTerm :: Var -> Nat -> Term -> Compile TCM (Expr -> Expr, Var)
- findPosition :: Nat -> [Maybe Term] -> Compile TCM (Maybe (Nat, Term))

# Documentation

dataParametersTCM :: QName -> TCM NatSource

Returns how many parameters a datatype has

:: (QName, Args) | |

-> Int | ABS |

-> Maybe Type | If Just, it is the type to insert patterns from is nothing if we only want to delete a binding. |

-> Term | Term to replace at pos |

-> Telescope | The telescope |

-> Compile TCM (Telescope, (Telescope, Type, Type)) |

insertTele i xs t tele
tpos
tele := Gamma ; (i : T as) ; Delta
n := parameters T
xs' := xs `apply`

(take n as)
becomes
tpos
( Gamma ; xs' ; Delta[i := t] --note that Delta still reference Gamma correctly
, T as ^ (size xs')
)

we raise the type since we have added xs' new bindings before Gamma, and as can only bind to Gamma.

remForced :: [Fun] -> Compile TCM [Fun]Source

Main function for removing pattern matching on forced variables

forcedExpr :: [Var] -> Telescope -> Expr -> Compile TCM ExprSource

For a given expression, in a certain telescope (the list of Var) is a mapping of variable name to the telescope.

replaceForced :: ([Var], [Var]) -> Telescope -> [Var] -> [Maybe Term] -> Expr -> Compile TCM ExprSource

replace the forcedVar with pattern matching from the outside.