cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2022 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Ledger.Credential.Safe

Description

Re-exports functionality provided by module Credential , but with a safer interface.

Synopsis

Safe Ptr interface

data Ptr Source #

Pointer to a slot number, transaction index and an index in certificate list.

Instances

Instances details
Eq Ptr
Instance details

Defined in Cardano.Ledger.Credential

Ord Ptr
Instance details

Defined in Cardano.Ledger.Credential

Show Ptr
Instance details

Defined in Cardano.Ledger.Credential

Generic Ptr
Instance details

Defined in Cardano.Ledger.Credential

Associated Types

type Rep Ptr :: Type -> Type Source #

NFData Ptr
Instance details

Defined in Cardano.Ledger.Credential

Methods

rnf :: Ptr -> () Source #

FromCBOR Ptr
Instance details

Defined in Cardano.Ledger.Credential

ToCBOR Ptr
Instance details

Defined in Cardano.Ledger.Credential

ToCBORGroup Ptr
Instance details

Defined in Cardano.Ledger.Credential

FromCBORGroup Ptr
Instance details

Defined in Cardano.Ledger.Credential

NoThunks Ptr
Instance details

Defined in Cardano.Ledger.Credential

type Rep Ptr
Instance details

Defined in Cardano.Ledger.Credential

safePtr :: SlotNo32 -> TxIx -> CertIx -> Ptr Source #

Safely constructs a Ptr without silent truncation of slot numbers.

Use toSlotNo32 to convert an ordinary SlotNo to a SlotNo32 .

This function should satisfy the following property:

safeUnwrapPtr (safePtr s t c) == (s, t, c)

safeUnwrapPtr :: Ptr -> ( SlotNo32 , TxIx , CertIx ) Source #

Safely deconstructs a Ptr .

Use fromSlotNo32 to convert the returned slot number to a SlotNo .

This function should satisfy the following property:

safeUnwrapPtr (safePtr s t c) == (s, t, c)

Conversions to and from Slot32

toSlotNo32 :: SlotNo -> Maybe SlotNo32 Source #

Converts an ordinary SlotNo into a SlotNo32 .

Returns Nothing if the slot number could not be converted safely.