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

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

Clash.Core.TyCon

Description

Type Constructors in CoreHW

Synopsis

- data TyCon
  - = AlgTyCon {
    - tyConUniq :: !Unique
    - tyConName :: !TyConName
    - tyConKind :: !Kind
    - tyConArity :: !Int
    - algTcRhs :: !AlgTyConRhs
    - isClassTc :: !Bool
    }
  - | PromotedDataCon {
    - tyConUniq :: !Unique
    - tyConName :: !TyConName
    - tyConKind :: !Kind
    - tyConArity :: !Int
    - tyConData :: !DataCon
    }
  - | FunTyCon {
    - tyConUniq :: !Unique
    - tyConName :: !TyConName
    - tyConKind :: !Kind
    - tyConArity :: !Int
    - tyConSubst :: [([Type], Type)]
    }
  - | PrimTyCon {
    - tyConUniq :: !Unique
    - tyConName :: !TyConName
    - tyConKind :: !Kind
    - tyConArity :: !Int
    }
- type TyConName = Name TyCon
- type TyConMap = UniqMap TyCon
- data AlgTyConRhs
  - = DataTyCon {
    - dataCons :: [DataCon]
    }
  - | NewTyCon {
    - dataCon :: !DataCon
    - ntEtadRhs :: ([TyVar], Type)
    }
- mkKindTyCon :: TyConName -> Kind -> TyCon
- isTupleTyConLike :: TyConName -> Bool
- isPrimTc :: TyCon -> Bool
- isNewTypeTc :: TyCon -> Bool
- isPromotedDc :: TyCon -> Bool
- tyConDataCons :: TyCon -> [DataCon]

# Documentation

data TyCon Source #

Type Constructor

Constructors

AlgTyCon | Algorithmic DataCons

Fields

- tyConUniq :: !Unique
- tyConName :: !TyConName

  Name of the TyCon

- tyConKind :: !Kind

  Kind of the TyCon

- tyConArity :: !Int

  Number of type arguments

- algTcRhs :: !AlgTyConRhs

  DataCon definitions

- isClassTc :: !Bool

  Is this a class dictionary?

PromotedDataCon |

Fields

- tyConUniq :: !Unique
- tyConName :: !TyConName

  Name of the TyCon

- tyConKind :: !Kind

  Kind of the TyCon

- tyConArity :: !Int

  Number of type arguments

- tyConData :: !DataCon

  DataCon which is promoted

FunTyCon | Function TyCons (e.g. type families)

Fields

- tyConUniq :: !Unique
- tyConName :: !TyConName

  Name of the TyCon

- tyConKind :: !Kind

  Kind of the TyCon

- tyConArity :: !Int

  Number of type arguments

- tyConSubst :: [([Type], Type)]

  List of: ([LHS match types], RHS type)

PrimTyCon | Primitive TyCons

Fields

- tyConUniq :: !Unique
- tyConName :: !TyConName

  Name of the TyCon

- tyConKind :: !Kind

  Kind of the TyCon

- tyConArity :: !Int

  Number of type arguments

#### Instances

Instances details

Binary TyCon Source # |
Instance details Defined in Clash.Core.TyCon Methods put :: TyCon -> Put Source # get :: Get TyCon Source # putList :: [TyCon] -> Put Source #
HasType TyCon Source # |
Instance details Defined in Clash.Core.HasType Methods coreTypeOf :: TyCon -> Type Source #
PrettyPrec TyCon Source # |
Instance details Defined in Clash.Core.Pretty Methods pprPrec :: Monad m => Rational -> TyCon -> m ClashDoc Source # pprPrec' :: Monad m => PrettyOptions -> Rational -> TyCon -> m ClashDoc Source #
Uniquable TyCon Source # |
Instance details Defined in Clash.Core.TyCon Methods getUnique :: TyCon -> Unique Source # setUnique :: TyCon -> Unique -> TyCon Source #
NFData TyCon Source # |
Instance details Defined in Clash.Core.TyCon Methods rnf :: TyCon -> () Source #
Generic TyCon Source # |

Instance details

Defined in Clash.Core.TyCon

Associated Types

type Rep TyCon |

Instance details

Defined in Clash.Core.TyCon

type Rep TyCon = D1 ('MetaData "TyCon" "Clash.Core.TyCon" "clash-lib-1.8.4-CsViYhmcYd4KTpfwGN07cn" 'False) ((C1 ('MetaCons "AlgTyCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: (S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName) :*: S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind))) :*: (S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "algTcRhs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AlgTyConRhs) :*: S1 ('MetaSel ('Just "isClassTc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) :+: C1 ('MetaCons "PromotedDataCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName)) :*: (S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind) :*: (S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "tyConData") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DataCon))))) :+: (C1 ('MetaCons "FunTyCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName)) :*: (S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind) :*: (S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "tyConSubst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [([Type], Type)])))) :+: C1 ('MetaCons "PrimTyCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName)) :*: (S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind) :*: S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))))

Methods

from :: TyCon -> Rep TyCon x Source #

to :: Rep TyCon x -> TyCon Source #

Show TyCon Source # |
Instance details Defined in Clash.Core.TyCon Methods showsPrec :: Int -> TyCon -> ShowS Source # show :: TyCon -> String Source # showList :: [TyCon] -> ShowS Source #
Eq TyCon Source # |
Instance details Defined in Clash.Core.TyCon Methods (==) :: TyCon -> TyCon -> Bool Source # (/=) :: TyCon -> TyCon -> Bool Source #
type Rep TyCon Source # |

Instance details

Defined in Clash.Core.TyCon

type Rep TyCon = D1 ('MetaData "TyCon" "Clash.Core.TyCon" "clash-lib-1.8.4-CsViYhmcYd4KTpfwGN07cn" 'False) ((C1 ('MetaCons "AlgTyCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: (S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName) :*: S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind))) :*: (S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "algTcRhs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AlgTyConRhs) :*: S1 ('MetaSel ('Just "isClassTc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) :+: C1 ('MetaCons "PromotedDataCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName)) :*: (S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind) :*: (S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "tyConData") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DataCon))))) :+: (C1 ('MetaCons "FunTyCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName)) :*: (S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind) :*: (S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "tyConSubst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [([Type], Type)])))) :+: C1 ('MetaCons "PrimTyCon" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tyConUniq") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Unique) :*: S1 ('MetaSel ('Just "tyConName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TyConName)) :*: (S1 ('MetaSel ('Just "tyConKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Kind) :*: S1 ('MetaSel ('Just "tyConArity") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))))

type TyConName = Name TyCon Source #

TyCon reference

type TyConMap = UniqMap TyCon Source #

data AlgTyConRhs Source #

The RHS of an Algebraic Datatype

Constructors

DataTyCon |

Fields

- dataCons :: [DataCon]

  The DataCons of a TyCon

NewTyCon |

Fields

- dataCon :: !DataCon

  The newtype DataCon

- ntEtadRhs :: ([TyVar], Type)

  The argument type of the newtype DataCon in eta-reduced form, which is just the representation of the TyCon. The TyName's are the type-variables from the corresponding TyCon.

#### Instances

Instances details

Binary AlgTyConRhs Source # |
Instance details Defined in Clash.Core.TyCon Methods put :: AlgTyConRhs -> Put Source # get :: Get AlgTyConRhs Source # putList :: [AlgTyConRhs] -> Put Source #
NFData AlgTyConRhs Source # |
Instance details Defined in Clash.Core.TyCon Methods rnf :: AlgTyConRhs -> () Source #
Generic AlgTyConRhs Source # |

Instance details

Defined in Clash.Core.TyCon

Associated Types

type Rep AlgTyConRhs |

Instance details

Defined in Clash.Core.TyCon

type Rep AlgTyConRhs = D1 ('MetaData "AlgTyConRhs" "Clash.Core.TyCon" "clash-lib-1.8.4-CsViYhmcYd4KTpfwGN07cn" 'False) (C1 ('MetaCons "DataTyCon" 'PrefixI 'True) (S1 ('MetaSel ('Just "dataCons") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [DataCon])) :+: C1 ('MetaCons "NewTyCon" 'PrefixI 'True) (S1 ('MetaSel ('Just "dataCon") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DataCon) :*: S1 ('MetaSel ('Just "ntEtadRhs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ([TyVar], Type))))

Methods

from :: AlgTyConRhs -> Rep AlgTyConRhs x Source #

to :: Rep AlgTyConRhs x -> AlgTyConRhs Source #

Show AlgTyConRhs Source # |
Instance details Defined in Clash.Core.TyCon Methods showsPrec :: Int -> AlgTyConRhs -> ShowS Source # show :: AlgTyConRhs -> String Source # showList :: [AlgTyConRhs] -> ShowS Source #
type Rep AlgTyConRhs Source # |

Instance details

Defined in Clash.Core.TyCon

type Rep AlgTyConRhs = D1 ('MetaData "AlgTyConRhs" "Clash.Core.TyCon" "clash-lib-1.8.4-CsViYhmcYd4KTpfwGN07cn" 'False) (C1 ('MetaCons "DataTyCon" 'PrefixI 'True) (S1 ('MetaSel ('Just "dataCons") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [DataCon])) :+: C1 ('MetaCons "NewTyCon" 'PrefixI 'True) (S1 ('MetaSel ('Just "dataCon") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DataCon) :*: S1 ('MetaSel ('Just "ntEtadRhs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ([TyVar], Type))))

mkKindTyCon :: TyConName -> Kind -> TyCon Source #

Create a Kind out of a TyConName

isTupleTyConLike :: TyConName -> Bool Source #

Does the TyCon look like a tuple TyCon

isPrimTc :: TyCon -> Bool Source #

isNewTypeTc :: TyCon -> Bool Source #

isPromotedDc :: TyCon -> Bool Source #

tyConDataCons :: TyCon -> [DataCon] Source #

Get the DataCons belonging to a TyCon