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

- 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
- mkVec :: DataCon -> DataCon -> Type -> Integer -> [Term] -> Term
- appendToVec :: DataCon -> Type -> Term -> Integer -> [Term] -> Term
- extractElems :: DataCon -> Type -> Char -> Integer -> Term -> [(Term, [LetBinding])]
- isSignalType :: HashMap TyConName TyCon -> Type -> Bool
- tyNatSize :: HashMap TyConName TyCon -> Type -> Except String Integer

# 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?

isPolyFun :: (Functor m, Fresh m) => HashMap TyConName 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

isSignalType :: HashMap TyConName 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.