clash-lib-0.99.2: 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 # 
Instance details

Defined in Clash.Core.Type

Methods

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

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

Ord Type Source # 
Instance details

Defined in Clash.Core.Type

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 # 
Instance details

Defined in Clash.Core.Type

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Generic Type Source # 
Instance details

Defined in Clash.Core.Type

Associated Types

type Rep Type :: * -> * #

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

NFData Type Source # 
Instance details

Defined in Clash.Core.Type

Methods

rnf :: Type -> () #

Hashable Type Source # 
Instance details

Defined in Clash.Core.Type

Methods

hashWithSalt :: Int -> Type -> Int

hash :: Type -> Int

Alpha Type Source # 
Instance details

Defined in Clash.Core.Type

Methods

aeq' :: AlphaCtx -> Type -> Type -> Bool

fvAny' :: (Contravariant f, Applicative f) => AlphaCtx -> (AnyName -> f AnyName) -> Type -> f Type

close :: AlphaCtx -> NamePatFind -> Type -> Type

open :: AlphaCtx -> NthPatFind -> Type -> Type

isPat :: Type -> DisjointSet AnyName

isTerm :: Type -> All

isEmbed :: Type -> Bool

nthPatFind :: Type -> NthPatFind

namePatFind :: Type -> NamePatFind

swaps' :: AlphaCtx -> Perm AnyName -> Type -> Type

lfreshen' :: LFresh m => AlphaCtx -> Type -> (Type -> Perm AnyName -> m b) -> m b

freshen' :: Fresh m => AlphaCtx -> Type -> m (Type, Perm AnyName)

acompare' :: AlphaCtx -> Type -> Type -> Ordering

Pretty Type Source # 
Instance details

Defined in Clash.Core.Pretty

Methods

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

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

Subst Term Type Source # 
Instance details

Defined in Clash.Core.Type

Methods

isvar :: Type -> Maybe (SubstName Type Term)

isCoerceVar :: Type -> Maybe (SubstCoerce Type Term)

subst :: Name Term -> Term -> Type -> Type

substs :: [(Name Term, Term)] -> Type -> Type

Subst Type Term 
Instance details

Defined in Clash.Core.Term

Methods

isvar :: Term -> Maybe (SubstName Term Type)

isCoerceVar :: Term -> Maybe (SubstCoerce Term Type)

subst :: Name Type -> Type -> Term -> Term

substs :: [(Name Type, Type)] -> Term -> Term

Subst Type Type Source # 
Instance details

Defined in Clash.Core.Type

Methods

isvar :: Type -> Maybe (SubstName Type Type)

isCoerceVar :: Type -> Maybe (SubstCoerce Type Type)

subst :: Name Type -> Type -> Type -> Type

substs :: [(Name Type, Type)] -> Type -> Type

Subst Type Pat 
Instance details

Defined in Clash.Core.Term

Methods

isvar :: Pat -> Maybe (SubstName Pat Type)

isCoerceVar :: Pat -> Maybe (SubstCoerce Pat Type)

subst :: Name Type -> Type -> Pat -> Pat

substs :: [(Name Type, Type)] -> Pat -> Pat

Generic b => Subst Type (Var b) 
Instance details

Defined in Clash.Core.Var

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 # 
Instance details

Defined in Clash.Core.Pretty

Methods

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

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

type Rep Type Source # 
Instance details

Defined in Clash.Core.Type

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

Instances
Show TypeView Source # 
Instance details

Defined in Clash.Core.Type

data ConstTy Source #

Type Constants

Constructors

TyCon !TyConName

TyCon type

Arrow

Function type

Instances
Show ConstTy Source # 
Instance details

Defined in Clash.Core.Type

Generic ConstTy Source # 
Instance details

Defined in Clash.Core.Type

Associated Types

type Rep ConstTy :: * -> * #

Methods

from :: ConstTy -> Rep ConstTy x #

to :: Rep ConstTy x -> ConstTy #

NFData ConstTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

rnf :: ConstTy -> () #

Hashable ConstTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

hashWithSalt :: Int -> ConstTy -> Int

hash :: ConstTy -> Int

Alpha ConstTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

aeq' :: AlphaCtx -> ConstTy -> ConstTy -> Bool

fvAny' :: (Contravariant f, Applicative f) => AlphaCtx -> (AnyName -> f AnyName) -> ConstTy -> f ConstTy

close :: AlphaCtx -> NamePatFind -> ConstTy -> ConstTy

open :: AlphaCtx -> NthPatFind -> ConstTy -> ConstTy

isPat :: ConstTy -> DisjointSet AnyName

isTerm :: ConstTy -> All

isEmbed :: ConstTy -> Bool

nthPatFind :: ConstTy -> NthPatFind

namePatFind :: ConstTy -> NamePatFind

swaps' :: AlphaCtx -> Perm AnyName -> ConstTy -> ConstTy

lfreshen' :: LFresh m => AlphaCtx -> ConstTy -> (ConstTy -> Perm AnyName -> m b) -> m b

freshen' :: Fresh m => AlphaCtx -> ConstTy -> m (ConstTy, Perm AnyName)

acompare' :: AlphaCtx -> ConstTy -> ConstTy -> Ordering

Subst a ConstTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

isvar :: ConstTy -> Maybe (SubstName ConstTy a)

isCoerceVar :: ConstTy -> Maybe (SubstCoerce ConstTy a)

subst :: Name a -> a -> ConstTy -> ConstTy

substs :: [(Name a, a)] -> ConstTy -> ConstTy

type Rep ConstTy Source # 
Instance details

Defined in Clash.Core.Type

type Rep ConstTy = D1 (MetaData "ConstTy" "Clash.Core.Type" "clash-lib-0.99.2-inplace" False) (C1 (MetaCons "TyCon" PrefixI False) (S1 (MetaSel (Nothing :: Maybe 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 # 
Instance details

Defined in Clash.Core.Type

Methods

showsPrec :: Int -> LitTy -> ShowS #

show :: LitTy -> String #

showList :: [LitTy] -> ShowS #

Generic LitTy Source # 
Instance details

Defined in Clash.Core.Type

Associated Types

type Rep LitTy :: * -> * #

Methods

from :: LitTy -> Rep LitTy x #

to :: Rep LitTy x -> LitTy #

NFData LitTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

rnf :: LitTy -> () #

Hashable LitTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

hashWithSalt :: Int -> LitTy -> Int

hash :: LitTy -> Int

Alpha LitTy Source # 
Instance details

Defined in Clash.Core.Type

Methods

aeq' :: AlphaCtx -> LitTy -> LitTy -> Bool

fvAny' :: (Contravariant f, Applicative f) => AlphaCtx -> (AnyName -> f AnyName) -> LitTy -> f LitTy

close :: AlphaCtx -> NamePatFind -> LitTy -> LitTy

open :: AlphaCtx -> NthPatFind -> LitTy -> LitTy

isPat :: LitTy -> DisjointSet AnyName

isTerm :: LitTy -> All

isEmbed :: LitTy -> Bool

nthPatFind :: LitTy -> NthPatFind

namePatFind :: LitTy -> NamePatFind

swaps' :: AlphaCtx -> Perm AnyName -> LitTy -> LitTy

lfreshen' :: LFresh m => AlphaCtx -> LitTy -> (LitTy -> Perm AnyName -> m b) -> m b

freshen' :: Fresh m => AlphaCtx -> LitTy -> m (LitTy, Perm AnyName)

acompare' :: AlphaCtx -> LitTy -> LitTy -> Ordering

Pretty LitTy Source # 
Instance details

Defined in Clash.Core.Pretty

Methods

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

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

Subst a LitTy Source # 
Instance details

Defined in Clash.Core.Type

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 # 
Instance details

Defined in Clash.Core.Type

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

findFunSubst :: HashMap TyConOccName TyCon -> [([Type], Type)] -> [Type] -> Maybe Type Source #

undefinedTy :: Type Source #

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