Copyright | (C) 2012-2016 University of Twente |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Smart constructor and destructor functions for CoreHW
Synopsis
- type Gamma = HashMap TmOccName Type
- type Delta = HashMap TyOccName Kind
- termType :: Fresh m => HashMap TyConOccName TyCon -> Term -> m Type
- collectArgs :: Term -> (Term, [Either Term Type])
- collectBndrs :: Fresh m => Term -> m ([Either Id TyVar], Term)
- applyTypeToArgs :: Fresh m => HashMap TyConOccName 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 :: Fresh m => HashMap TyConOccName TyCon -> Term -> m Bool
- isPolyFun :: Fresh m => HashMap TyConOccName 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 -> Word
- mkVec :: DataCon -> DataCon -> Type -> Integer -> [Term] -> Term
- appendToVec :: DataCon -> Type -> Term -> Integer -> [Term] -> Term
- extractElems :: DataCon -> Type -> Char -> Integer -> Term -> [(Term, [LetBinding])]
- extractTElems :: DataCon -> DataCon -> Type -> Char -> Integer -> Term -> ([Term], [LetBinding])
- mkRTree :: DataCon -> DataCon -> Type -> Integer -> [Term] -> Term
- isSignalType :: HashMap TyConOccName TyCon -> Type -> Bool
- isClockOrReset :: HashMap TyConOccName TyCon -> Type -> Bool
- tyNatSize :: HashMap TyConOccName TyCon -> Type -> Except String Integer
Documentation
termType :: Fresh m => HashMap TyConOccName 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 TyConOccName 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 :: Fresh m => HashMap TyConOccName TyCon -> Term -> m Bool Source #
Does a term have a function type?
isPolyFun :: Fresh m => HashMap TyConOccName TyCon -> Term -> m Bool Source #
Does a term have a function or polymorphic type?
:: DataCon | The Nil constructor |
-> DataCon | The Cons (:>) constructor |
-> Type | Element type |
-> Integer | Length of the vector |
-> [Term] | Elements to put in the vector |
-> Term |
Create a vector of supplied elements
:: DataCon | The Cons (:>) constructor |
-> Type | Element type |
-> Term | The vector to append the elements to |
-> Integer | Length of the vector |
-> [Term] | Elements to append |
-> Term |
Append elements to the supplied vector
:: DataCon | The Cons (:>) constructor |
-> Type | The element type |
-> Char | Char to append to the bound variable names |
-> Integer | Length of the vector |
-> Term | The vector |
-> [(Term, [LetBinding])] |
Create let-bindings with case-statements that select elements out of a vector. Returns both the variables to which element-selections are bound and the let-bindings
:: DataCon | The |
-> DataCon | The |
-> Type | The element type |
-> Char | Char to append to the bound variable names |
-> Integer | Depth of the tree |
-> Term | The tree |
-> ([Term], [LetBinding]) |
Create let-bindings with case-statements that select elements out of a tree. Returns both the variables to which element-selections are bound and the let-bindings
:: DataCon | The LR constructor |
-> DataCon | The BR constructor |
-> Type | Element type |
-> Integer | Depth of the tree |
-> [Term] | Elements to put in the tree |
-> Term |
Create a vector of supplied elements
isSignalType :: HashMap TyConOccName TyCon -> Type -> Bool Source #
Determine whether a type is isomorphic to Clash.Signal.Internal.Signal'
It is i.e.:
- Signal' clk a
- (Signal' clk a, Signal' clk b)
- Vec n (Signal' clk a)
- data Wrap = W (Signal clk' Int)
- etc.
isClockOrReset :: HashMap TyConOccName TyCon -> Type -> Bool Source #