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

Copyright(C) 2012-2016 University of Twente
2016 Myrtle Software Ltd
2017 Google Inc.
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Core.Type

Description

Types in CoreHW

Synopsis

Documentation

data Type Source #

Types in CoreHW: function and polymorphic types

Constructors

VarTy !Kind !TyName

Type variable

ConstTy !ConstTy

Type constant

ForAllTy !(Bind TyVar Type)

Polymorphic Type

AppTy !Type !Type

Type Application

LitTy !LitTy

Type literal

Instances

Eq Type Source # 

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Show Type Source # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Generic Type Source # 

Associated Types

type Rep Type :: * -> * #

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

Hashable Type Source # 

Methods

hashWithSalt :: Int -> Type -> Int #

hash :: Type -> Int #

NFData Type Source # 

Methods

rnf :: Type -> () #

Alpha Type Source # 
Pretty Type Source # 

Methods

ppr :: LFresh m => Type -> m Doc Source #

pprPrec :: LFresh m => Rational -> Type -> m Doc Source #

Subst Term Type Source # 
Subst Type Term # 
Subst Type Type Source # 
Subst Type Pat # 
Generic b => Subst Type (Var b) # 

Methods

isvar :: Var b -> Maybe (SubstName (Var b) Type) #

isCoerceVar :: Var b -> Maybe (SubstCoerce (Var b) Type) #

subst :: Name Type -> Type -> Var b -> Var b #

substs :: [(Name Type, Type)] -> Var b -> Var b #

Pretty (Var Type) Source # 

Methods

ppr :: LFresh m => Var Type -> m Doc Source #

pprPrec :: LFresh m => Rational -> Var Type -> m Doc Source #

type Rep Type Source # 

data TypeView Source #

An easier view on types

Constructors

FunTy !Type !Type

Function type

TyConApp !TyConName [Type]

Applied TyCon

OtherType !Type

Neither of the above

data ConstTy Source #

Type Constants

Constructors

TyCon !TyConName

TyCon type

Arrow

Function type

Instances

Show ConstTy Source # 
Generic ConstTy Source # 

Associated Types

type Rep ConstTy :: * -> * #

Methods

from :: ConstTy -> Rep ConstTy x #

to :: Rep ConstTy x -> ConstTy #

Hashable ConstTy Source # 

Methods

hashWithSalt :: Int -> ConstTy -> Int #

hash :: ConstTy -> Int #

NFData ConstTy Source # 

Methods

rnf :: ConstTy -> () #

Alpha ConstTy Source # 
Subst a ConstTy Source # 
type Rep ConstTy Source # 
type Rep ConstTy = D1 * (MetaData "ConstTy" "Clash.Core.Type" "clash-lib-0.99-CApG5XjEMCZFUVyS8kIjXv" False) ((:+:) * (C1 * (MetaCons "TyCon" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * TyConName))) (C1 * (MetaCons "Arrow" PrefixI False) (U1 *)))

data LitTy Source #

Literal Types

Constructors

NumTy !Integer 
SymTy !String 

Instances

Show LitTy Source # 

Methods

showsPrec :: Int -> LitTy -> ShowS #

show :: LitTy -> String #

showList :: [LitTy] -> ShowS #

Generic LitTy Source # 

Associated Types

type Rep LitTy :: * -> * #

Methods

from :: LitTy -> Rep LitTy x #

to :: Rep LitTy x -> LitTy #

Hashable LitTy Source # 

Methods

hashWithSalt :: Int -> LitTy -> Int #

hash :: LitTy -> Int #

NFData LitTy Source # 

Methods

rnf :: LitTy -> () #

Alpha LitTy Source # 
Pretty LitTy Source # 

Methods

ppr :: LFresh m => LitTy -> m Doc Source #

pprPrec :: LFresh m => Rational -> LitTy -> m Doc Source #

Subst a LitTy Source # 

Methods

isvar :: LitTy -> Maybe (SubstName LitTy a) #

isCoerceVar :: LitTy -> Maybe (SubstCoerce LitTy a) #

subst :: Name a -> a -> LitTy -> LitTy #

substs :: [(Name a, a)] -> LitTy -> LitTy #

type Rep LitTy Source # 

type Kind = Type Source #

The level above types

type KindOrType = Type Source #

Either a Kind or a Type

type KiName = Name Kind Source #

Reference to a Kind

type TyName = Name Type Source #

Reference to a Type

type TyVar = Var Type Source #

Type variable

tyView :: Type -> TypeView Source #

An easier view on types

coreView :: HashMap TyConOccName TyCon -> Type -> Maybe Type Source #

A view on types in which newtypes are transparent, the Signal type is transparent, and type functions are evaluated to WHNF (when possible).

Only strips away one "layer".

typeKind :: HashMap TyConOccName TyCon -> Type -> Kind Source #

Determine the kind of a type

mkTyConTy :: TyConName -> Type Source #

Make a Type out of a TyCon

mkFunTy :: Type -> Type -> Type Source #

Make a function type of an argument and result type

mkTyConApp :: TyConName -> [Type] -> Type Source #

Make a TyCon Application out of a TyCon and a list of argument types

splitFunTy :: HashMap TyConOccName TyCon -> Type -> Maybe (Type, Type) Source #

Split a function type in an argument and result type

splitFunForallTy :: Type -> ([Either TyVar Type], Type) Source #

Split a poly-function type in a: list of type-binders and argument types, and the result type

splitCoreFunForallTy :: HashMap TyConOccName TyCon -> Type -> ([Either TyVar Type], Type) Source #

Split a poly-function type in a: list of type-binders and argument types, and the result type. Looks through Signal and type functions.

splitTyConAppM :: Type -> Maybe (TyConName, [Type]) Source #

Split a TyCon Application in a TyCon and its arguments

isPolyFunTy :: Type -> Bool Source #

Is a type a polymorphic or function type?

isPolyFunCoreTy :: HashMap TyConOccName TyCon -> Type -> Bool Source #

Is a type a polymorphic or function type under coreView?

isPolyTy :: Type -> Bool Source #

Is a type polymorphic?

isFunTy :: HashMap TyConOccName TyCon -> Type -> Bool Source #

Is a type a function type?

applyFunTy :: HashMap TyConOccName TyCon -> Type -> Type -> Type Source #

Apply a function type to an argument type and get the result type

applyTy :: Fresh m => HashMap TyConOccName TyCon -> Type -> KindOrType -> m Type Source #

Substitute the type variable of a type (ForAllTy) with another type

undefinedTy :: Type Source #

The type of GHC.Err.undefined :: forall a . a