Copyright | (c) 2025 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | None |
Language | GHC2021 |
GeniusYield.Types.Reexpose
Description
Synopsis
- newtype Port = Port {}
- data DnsName
- data Network
- class Bounded r => BoundedRational r where
- boundRational :: Rational -> Maybe r
- unboundRational :: r -> Rational
- data UnitInterval
- data ProtVer = ProtVer {}
- module Cardano.Ledger.Binary.Version
Documentation
Constructors
Port | |
Fields |
Instances
FromJSON Port | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
ToJSON Port | |||||
DecCBOR Port | |||||
EncCBOR Port | |||||
NFData Port | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
Generic Port | |||||
Defined in Cardano.Ledger.BaseTypes Associated Types
| |||||
Num Port | |||||
Show Port | |||||
Eq Port | |||||
Ord Port | |||||
NoThunks Port | |||||
type Rep Port | |||||
Defined in Cardano.Ledger.BaseTypes type Rep Port = D1 ('MetaData "Port" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-1.17.0.0-4816f6493dd543b78767f05e25bc94667cc1a25332fefdec96fe01e511f97bc7" 'True) (C1 ('MetaCons "Port" 'PrefixI 'True) (S1 ('MetaSel ('Just "portToWord16") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16))) |
Instances
FromJSON DnsName | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
ToJSON DnsName | |||||
DecCBOR DnsName | |||||
EncCBOR DnsName | |||||
NFData DnsName | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
Generic DnsName | |||||
Defined in Cardano.Ledger.BaseTypes Associated Types
| |||||
Show DnsName | |||||
Eq DnsName | |||||
Ord DnsName | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
NoThunks DnsName | |||||
type Rep DnsName | |||||
Defined in Cardano.Ledger.BaseTypes type Rep DnsName = D1 ('MetaData "DnsName" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-1.17.0.0-4816f6493dd543b78767f05e25bc94667cc1a25332fefdec96fe01e511f97bc7" 'True) (C1 ('MetaCons "DnsName" 'PrefixI 'True) (S1 ('MetaSel ('Just "dnsToText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) |
Instances
FromJSON Network | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
ToJSON Network | |||||
FromCBOR Network | |||||
ToCBOR Network | |||||
DecCBOR Network | |||||
EncCBOR Network | |||||
Default Network | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
NFData Network | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
Bounded Network | |||||
Enum Network | |||||
Generic Network | |||||
Defined in Cardano.Ledger.BaseTypes Associated Types
| |||||
Show Network | |||||
Eq Network | |||||
Ord Network | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
NoThunks Network | |||||
type Rep Network | |||||
Defined in Cardano.Ledger.BaseTypes type Rep Network = D1 ('MetaData "Network" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-1.17.0.0-4816f6493dd543b78767f05e25bc94667cc1a25332fefdec96fe01e511f97bc7" 'False) (C1 ('MetaCons "Testnet" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Mainnet" 'PrefixI 'False) (U1 :: Type -> Type)) |
class Bounded r => BoundedRational r where #
Type clases that allows conversion between Rational
and some form of bounded
rational type. Bounds can be restricted by both the Bounded
type class and underlyng
representation.
maybe True (\br -> minBound <= br && br <= maxBound) . boundRational
Roundtrip properties must hold:
\r -> maybe True ((r ==) . unboundRational) (boundRational r) \br -> Just br == boundRational (unboundRational br)
Methods
boundRational :: Rational -> Maybe r #
Returns Nothing
when supplied value is not within bounds or when precision is
too high to be represented by the underlying type
Example
>>>
:set -XTypeApplications
>>>
import Data.Ratio
>>>
boundRational @UnitInterval $ 2 % 3
Just (2 % 3)>>>
boundRational @UnitInterval (-0.5)
Nothing>>>
boundRational @UnitInterval (1.5)
Nothing>>>
boundRational @UnitInterval 0
Just (0 % 1)>>>
boundRational @PositiveUnitInterval 0
Nothing
unboundRational :: r -> Rational #
Promote bounded rational type into the unbounded Rational
.
Instances
BoundedRational NonNegativeInterval | |
Defined in Cardano.Ledger.BaseTypes Methods | |
BoundedRational PositiveInterval | |
Defined in Cardano.Ledger.BaseTypes Methods | |
BoundedRational PositiveUnitInterval | |
Defined in Cardano.Ledger.BaseTypes Methods | |
BoundedRational UnitInterval | |
Defined in Cardano.Ledger.BaseTypes Methods boundRational :: Rational -> Maybe UnitInterval # unboundRational :: UnitInterval -> Rational # | |
(Bounded (BoundedRatio b a), Bounded a, Integral a) => BoundedRational (BoundedRatio b a) | |
Defined in Cardano.Ledger.BaseTypes Methods boundRational :: Rational -> Maybe (BoundedRatio b a) # unboundRational :: BoundedRatio b a -> Rational # |
data UnitInterval #
Type to represent a value in the unit interval [0; 1]
Instances
Instances
FromJSON ProtVer | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
ToJSON ProtVer | |||||
FromCBOR ProtVer | |||||
ToCBOR ProtVer | |||||
DecCBOR ProtVer | |||||
EncCBOR ProtVer | |||||
DecCBORGroup ProtVer | |||||
Defined in Cardano.Ledger.BaseTypes Methods decCBORGroup :: Decoder s ProtVer # | |||||
EncCBORGroup ProtVer | |||||
ToPlutusData ProtVer | |||||
Defined in Cardano.Ledger.Plutus.ToPlutusData | |||||
NFData ProtVer | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
Generic ProtVer | |||||
Defined in Cardano.Ledger.BaseTypes Associated Types
| |||||
Show ProtVer | |||||
Eq ProtVer | |||||
Ord ProtVer | |||||
Defined in Cardano.Ledger.BaseTypes | |||||
NoThunks ProtVer | |||||
type Rep ProtVer | |||||
Defined in Cardano.Ledger.BaseTypes type Rep ProtVer = D1 ('MetaData "ProtVer" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-1.17.0.0-4816f6493dd543b78767f05e25bc94667cc1a25332fefdec96fe01e511f97bc7" 'False) (C1 ('MetaCons "ProtVer" 'PrefixI 'True) (S1 ('MetaSel ('Just "pvMajor") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Version) :*: S1 ('MetaSel ('Just "pvMinor") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Natural))) |