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

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

Clash.Core.Term

Description

Term representation in the CoreHW language: System F + LetRec + Case

Synopsis

Documentation

data Term Source #

Term representation in the CoreHW language: System F + LetRec + Case

Constructors

Var !Type !TmName

Variable reference

Data !DataCon

Datatype constructor

Literal !Literal

Literal

Prim !Text !Type

Primitive

Lam !(Bind Id Term)

Term-abstraction

TyLam !(Bind TyVar Term)

Type-abstraction

App !Term !Term

Application

TyApp !Term !Type

Type-application

Letrec !(Bind (Rec [LetBinding]) Term)

Recursive let-binding

Case !Term !Type [Alt]

Case-expression: subject, type of alternatives, list of alternatives

Cast !Term !Type !Type

Cast a term from one type to another

Instances
Eq Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

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

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

Ord Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

compare :: Term -> Term -> Ordering #

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

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

(>) :: Term -> Term -> Bool #

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

max :: Term -> Term -> Term #

min :: Term -> Term -> Term #

Show Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

showsPrec :: Int -> Term -> ShowS #

show :: Term -> String #

showList :: [Term] -> ShowS #

Generic Term Source # 
Instance details

Defined in Clash.Core.Term

Associated Types

type Rep Term :: * -> * #

Methods

from :: Term -> Rep Term x #

to :: Rep Term x -> Term #

NFData Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

rnf :: Term -> () #

Hashable Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

hashWithSalt :: Int -> Term -> Int

hash :: Term -> Int

Alpha Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

aeq' :: AlphaCtx -> Term -> Term -> Bool

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

close :: AlphaCtx -> NamePatFind -> Term -> Term

open :: AlphaCtx -> NthPatFind -> Term -> Term

isPat :: Term -> DisjointSet AnyName

isTerm :: Term -> All

isEmbed :: Term -> Bool

nthPatFind :: Term -> NthPatFind

namePatFind :: Term -> NamePatFind

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

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

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

acompare' :: AlphaCtx -> Term -> Term -> Ordering

Pretty Term Source # 
Instance details

Defined in Clash.Core.Pretty

Methods

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

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

Subst Term Term Source # 
Instance details

Defined in Clash.Core.Term

Methods

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

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

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

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

Subst Term Type 
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 Term Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

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

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

subst :: Name Term -> Term -> Pat -> Pat

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

Subst Type Term Source # 
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

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

Defined in Clash.Core.Var

Methods

isvar :: Var b -> Maybe (SubstName (Var b) Term)

isCoerceVar :: Var b -> Maybe (SubstCoerce (Var b) Term)

subst :: Name Term -> Term -> Var b -> Var b

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

Pretty (Var Term) Source # 
Instance details

Defined in Clash.Core.Pretty

Methods

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

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

Pretty (Id, Term) Source # 
Instance details

Defined in Clash.Core.Pretty

Methods

ppr :: LFresh m => (Id, Term) -> m Doc Source #

pprPrec :: LFresh m => Rational -> (Id, Term) -> m Doc Source #

type Rep Term Source # 
Instance details

Defined in Clash.Core.Term

type Rep Term = D1 (MetaData "Term" "Clash.Core.Term" "clash-lib-0.99.2-inplace" False) (((C1 (MetaCons "Var" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 TmName)) :+: C1 (MetaCons "Data" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 DataCon))) :+: (C1 (MetaCons "Literal" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Literal)) :+: (C1 (MetaCons "Prim" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type)) :+: C1 (MetaCons "Lam" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Bind Id Term)))))) :+: ((C1 (MetaCons "TyLam" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Bind TyVar Term))) :+: (C1 (MetaCons "App" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Term) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Term)) :+: C1 (MetaCons "TyApp" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Term) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type)))) :+: (C1 (MetaCons "Letrec" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Bind (Rec [LetBinding]) Term))) :+: (C1 (MetaCons "Case" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Term) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Alt]))) :+: C1 (MetaCons "Cast" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Term) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type)))))))

type TmName = Name Term Source #

Term reference

type LetBinding = (Id, Embed Term) Source #

Binding in a LetRec construct

data Pat Source #

Patterns in the LHS of a case-decomposition

Constructors

DataPat !(Embed DataCon) !(Rebind [TyVar] [Id])

Datatype pattern, '[TyVar]' bind existentially-quantified type-variables of a DataCon

LitPat !(Embed Literal)

Literal pattern

DefaultPat

Default pattern

Instances
Eq Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

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

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

Show Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

showsPrec :: Int -> Pat -> ShowS #

show :: Pat -> String #

showList :: [Pat] -> ShowS #

Generic Pat Source # 
Instance details

Defined in Clash.Core.Term

Associated Types

type Rep Pat :: * -> * #

Methods

from :: Pat -> Rep Pat x #

to :: Rep Pat x -> Pat #

NFData Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

rnf :: Pat -> () #

Hashable Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

hashWithSalt :: Int -> Pat -> Int

hash :: Pat -> Int

Alpha Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

aeq' :: AlphaCtx -> Pat -> Pat -> Bool

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

close :: AlphaCtx -> NamePatFind -> Pat -> Pat

open :: AlphaCtx -> NthPatFind -> Pat -> Pat

isPat :: Pat -> DisjointSet AnyName

isTerm :: Pat -> All

isEmbed :: Pat -> Bool

nthPatFind :: Pat -> NthPatFind

namePatFind :: Pat -> NamePatFind

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

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

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

acompare' :: AlphaCtx -> Pat -> Pat -> Ordering

Pretty Pat Source # 
Instance details

Defined in Clash.Core.Pretty

Methods

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

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

Subst Term Pat Source # 
Instance details

Defined in Clash.Core.Term

Methods

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

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

subst :: Name Term -> Term -> Pat -> Pat

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

Subst Type Pat Source # 
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

type Rep Pat Source # 
Instance details

Defined in Clash.Core.Term

type Alt = Bind Pat Term Source #