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

Safe HaskellNone

CLaSH.Core.Util

Description

Smart constructor and destructor functions for CoreHW

Synopsis

Documentation

type Gamma = HashMap TmName TypeSource

Type environment/context

type Delta = HashMap TyName KindSource

Kind environment/context

termType :: (Functor m, Fresh m) => Term -> m TypeSource

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 => Type -> [Either Term Type] -> m TypeSource

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 -> TyVarSource

Make a type variable

mkId :: Type -> TmName -> IdSource

Make a term variable

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

Abstract a term over a list of term and type variables

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

Abstract a term over a list of term variables

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

Abstract a term over a list of type variables

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

Apply a list of types and terms to a term

mkTmApps :: Term -> [Term] -> TermSource

Apply a list of terms to a term

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

Apply a list of types to a term

isFun :: (Functor m, Fresh m) => Term -> m BoolSource

Does a term have a function type?

isLam :: Term -> BoolSource

Is a term a term-abstraction?

isLet :: Term -> BoolSource

Is a term a recursive let-binding?

isVar :: Term -> BoolSource

Is a term a variable reference?

isCon :: Term -> BoolSource

Is a term a datatype constructor?

isPrim :: Term -> BoolSource

Is a term a primitive?

idToVar :: Id -> TermSource

Make variable reference out of term variable

varToId :: Term -> IdSource

Make a term variable out of a variable reference