Safe Haskell | None |
---|---|

Language | Haskell2010 |

Smart constructor and destructor functions for CoreHW

- type Gamma = HashMap TmName Type
- type Delta = HashMap TyName Kind
- termType :: (Functor m, Fresh m) => HashMap TyConName TyCon -> Term -> m Type
- collectArgs :: Term -> (Term, [Either Term Type])
- collectBndrs :: Fresh m => Term -> m ([Either Id TyVar], Term)
- applyTypeToArgs :: Fresh m => HashMap TyConName TyCon -> Type -> [Either Term Type] -> m Type
- patIds :: Pat -> [Id]
- mkTyVar :: Kind -> TyName -> TyVar
- mkId :: Type -> TmName -> Id
- mkAbstraction :: Term -> [Either Id TyVar] -> Term
- mkTyLams :: Term -> [TyVar] -> Term
- mkLams :: Term -> [Id] -> Term
- mkApps :: Term -> [Either Term Type] -> Term
- mkTmApps :: Term -> [Term] -> Term
- mkTyApps :: Term -> [Type] -> Term
- isFun :: (Functor m, Fresh m) => HashMap TyConName TyCon -> Term -> m Bool
- isPolyFun :: (Functor m, Fresh m) => HashMap TyConName TyCon -> Term -> m Bool
- isLam :: Term -> Bool
- isLet :: Term -> Bool
- isVar :: Term -> Bool
- isCon :: Term -> Bool
- isPrim :: Term -> Bool
- idToVar :: Id -> Term
- varToId :: Term -> Id
- termSize :: Term -> Int

# Documentation

termType :: (Functor m, Fresh m) => HashMap TyConName TyCon -> Term -> m Type Source

Determine the type of a term

collectArgs :: Term -> (Term, [Either Term Type]) Source

Split a (Type)Application in the applied term and it arguments

collectBndrs :: Fresh m => Term -> m ([Either Id TyVar], Term) Source

Split a (Type)Abstraction in the bound variables and the abstracted term

applyTypeToArgs :: Fresh m => HashMap TyConName TyCon -> Type -> [Either Term Type] -> m Type Source

Get the result type of a polymorphic function given a list of arguments

mkAbstraction :: Term -> [Either Id TyVar] -> Term Source

Abstract a term over a list of term and type variables

isFun :: (Functor m, Fresh m) => HashMap TyConName TyCon -> Term -> m Bool Source

Does a term have a function type?