clash-lib-0.5.2: CAES Language for Synchronous Hardware - As a Library

Safe HaskellNone
LanguageHaskell2010

CLaSH.Core.Util

Description

Smart constructor and destructor functions for CoreHW

Synopsis

Documentation

type Gamma = HashMap TmName Type Source

Type environment/context

type Delta = HashMap TyName Kind Source

Kind environment/context

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

patIds :: Pat -> [Id] Source

Get the list of term-binders out of a DataType pattern

mkTyVar :: Kind -> TyName -> TyVar Source

Make a type variable

mkId :: Type -> TmName -> Id Source

Make a term variable

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

Abstract a term over a list of term and type variables

mkTyLams :: Term -> [TyVar] -> Term Source

Abstract a term over a list of term variables

mkLams :: Term -> [Id] -> Term Source

Abstract a term over a list of type variables

mkApps :: Term -> [Either Term Type] -> Term Source

Apply a list of types and terms to a term

mkTmApps :: Term -> [Term] -> Term Source

Apply a list of terms to a term

mkTyApps :: Term -> [Type] -> Term Source

Apply a list of types to a term

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

Does a term have a function type?

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

Does a term have a function or polymorphic type?

isLam :: Term -> Bool Source

Is a term a term-abstraction?

isLet :: Term -> Bool Source

Is a term a recursive let-binding?

isVar :: Term -> Bool Source

Is a term a variable reference?

isCon :: Term -> Bool Source

Is a term a datatype constructor?

isPrim :: Term -> Bool Source

Is a term a primitive?

idToVar :: Id -> Term Source

Make variable reference out of term variable

varToId :: Term -> Id Source

Make a term variable out of a variable reference