clash-lib-1.8.1: Clash: a functional hardware description language - As a library

Copyright | (C) 2012-2016 University of Twente 2017-2018 Google Inc. 2021 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | Safe-Inferred
Language | Haskell2010

Clash.Core.Var

Description

Variables in CoreHW

Synopsis

- data Var a
  - = TyVar {
    - varName :: !(Name a)
    - varUniq :: !Unique
    - varType :: Kind
    }
  - | Id {
    - varName :: !(Name a)
    - varUniq :: !Unique
    - varType :: Type
    - idScope :: IdScope
    }
- data IdScope
  - = GlobalId
  - | LocalId
- type Id = Var Term
- type TyVar = Var Type
- mkId :: Type -> IdScope -> TmName -> Id
- mkLocalId :: Type -> TmName -> Id
- mkGlobalId :: Type -> TmName -> Id
- mkTyVar :: Kind -> TyName -> TyVar
- setIdScope :: IdScope -> Var a -> Var a
- modifyVarName :: (Name a -> Name a) -> Var a -> Var a
- isGlobalId :: Var a -> Bool
- isLocalId :: Var a -> Bool

# Documentation

data Var a Source #

Variables in CoreHW

Constructors

TyVar | Constructor for type variables

Fields

- varName :: !(Name a)
- varUniq :: !Unique

  Invariant: forall x . varUniq x ~ nameUniq (varName x)

- varType :: Kind

Id | Constructor for term variables

Fields

- varName :: !(Name a)
- varUniq :: !Unique

  Invariant: forall x . varUniq x ~ nameUniq (varName x)

- varType :: Type
- idScope :: IdScope

#### Instances

Instances details

Generic (Var a) Source # |
Instance details Defined in Clash.Core.Var Associated Types type Rep (Var a) :: Type -> Type Source # Methods from :: Var a -> Rep (Var a) x Source # to :: Rep (Var a) x -> Var a Source #
Show (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods showsPrec :: Int -> Var a -> ShowS Source # show :: Var a -> String Source # showList :: [Var a] -> ShowS Source #
Binary (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods put :: Var a -> Put Source # get :: Get (Var a) Source # putList :: [Var a] -> Put Source #
HasType (Var a) Source # |
Instance details Defined in Clash.Core.HasType Methods coreTypeOf :: Var a -> Type Source #
PrettyPrec (Var a) Source # |
Instance details Defined in Clash.Core.Pretty Methods pprPrec :: Monad m => Rational -> Var a -> m ClashDoc Source # pprPrec' :: Monad m => PrettyOptions -> Rational -> Var a -> m ClashDoc Source #
ClashPretty (Var a) Source # |
Instance details Defined in Clash.Core.Pretty Methods clashPretty :: Var a -> Doc () Source #
Uniquable (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods getUnique :: Var a -> Unique Source # setUnique :: Var a -> Unique -> Var a Source #
NFData (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods rnf :: Var a -> () Source #
Eq (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods (==) :: Var a -> Var a -> Bool Source # (/=) :: Var a -> Var a -> Bool Source #
Ord (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods compare :: Var a -> Var a -> Ordering Source # (<) :: Var a -> Var a -> Bool Source # (<=) :: Var a -> Var a -> Bool Source # (>) :: Var a -> Var a -> Bool Source # (>=) :: Var a -> Var a -> Bool Source # max :: Var a -> Var a -> Var a Source # min :: Var a -> Var a -> Var a Source #
Hashable (Var a) Source # |
Instance details Defined in Clash.Core.Var Methods hashWithSalt :: Int -> Var a -> Int Source # hash :: Var a -> Int Source #
PrettyPrec (Id, Term) Source # |
Instance details Defined in Clash.Core.Pretty Methods pprPrec :: Monad m => Rational -> (Id, Term) -> m ClashDoc Source # pprPrec' :: Monad m => PrettyOptions -> Rational -> (Id, Term) -> m ClashDoc Source #
type Rep (Var a) Source # |

Instance details

Defined in Clash.Core.Var

type Rep (Var a) = D1 ('MetaData "Var" "Clash.Core.Var" "clash-lib-1.8.1-2YrsOtauO5B4MB9KvGiYOL" 'False) (C1 ('MetaCons "TyVar" 'PrefixI 'True) (S1 ('MetaSel ('Just "varName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Name a)) :*: (S1 ('MetaSel ('Just "varUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "varType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Kind))) :+: C1 ('MetaCons "Id" 'PrefixI 'True) ((S1 ('MetaSel ('Just "varName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Name a)) :*: S1 ('MetaSel ('Just "varUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique)) :*: (S1 ('MetaSel ('Just "varType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type) :*: S1 ('MetaSel ('Just "idScope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IdScope))))

data IdScope Source #

Constructors

GlobalId |
LocalId |

#### Instances

Instances details

Generic IdScope Source # |
Instance details Defined in Clash.Core.Var Associated Types type Rep IdScope :: Type -> Type Source # Methods from :: IdScope -> Rep IdScope x Source # to :: Rep IdScope x -> IdScope Source #
Show IdScope Source # |
Instance details Defined in Clash.Core.Var Methods showsPrec :: Int -> IdScope -> ShowS Source # show :: IdScope -> String Source # showList :: [IdScope] -> ShowS Source #
Binary IdScope Source # |
Instance details Defined in Clash.Core.Var Methods put :: IdScope -> Put Source # get :: Get IdScope Source # putList :: [IdScope] -> Put Source #
NFData IdScope Source # |
Instance details Defined in Clash.Core.Var Methods rnf :: IdScope -> () Source #
Eq IdScope Source # |
Instance details Defined in Clash.Core.Var Methods (==) :: IdScope -> IdScope -> Bool Source # (/=) :: IdScope -> IdScope -> Bool Source #
Ord IdScope Source # |
Instance details Defined in Clash.Core.Var Methods compare :: IdScope -> IdScope -> Ordering Source # (<) :: IdScope -> IdScope -> Bool Source # (<=) :: IdScope -> IdScope -> Bool Source # (>) :: IdScope -> IdScope -> Bool Source # (>=) :: IdScope -> IdScope -> Bool Source # max :: IdScope -> IdScope -> IdScope Source # min :: IdScope -> IdScope -> IdScope Source #
Hashable IdScope Source # |
Instance details Defined in Clash.Core.Var Methods hashWithSalt :: Int -> IdScope -> Int Source # hash :: IdScope -> Int Source #
type Rep IdScope Source # |
Instance details Defined in Clash.Core.Var type Rep IdScope = D1 ('MetaData "IdScope" "Clash.Core.Var" "clash-lib-1.8.1-2YrsOtauO5B4MB9KvGiYOL" 'False) (C1 ('MetaCons "GlobalId" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LocalId" 'PrefixI 'False) (U1 :: Type -> Type))

type Id = Var Term Source #

Term variable

type TyVar = Var Type Source #

Type variable

mkId :: Type -> IdScope -> TmName -> Id Source #

Make a term variable

mkLocalId :: Type -> TmName -> Id Source #

mkGlobalId :: Type -> TmName -> Id Source #

mkTyVar :: Kind -> TyName -> TyVar Source #

Make a type variable

setIdScope :: IdScope -> Var a -> Var a Source #

modifyVarName :: (Name a -> Name a) -> Var a -> Var a Source #

Change the name of a variable

isGlobalId :: Var a -> Bool Source #

isLocalId :: Var a -> Bool Source #