Prelude
The pieces that make up the Daml language.Module Snapshot
Lifecycle
Stable.
Notices
Status:
active
Introduced in: 3.4.9
Removed in: -
Warnings: 0
Deprecations: 0
Deprecated since: -Data Types
data AnyChoice
Existential choice type that can wrap an arbitrary choice.
Constructors:
AnyChoice
Any
TemplateTypeRep
data AnyTemplate
Existential template type that can wrap an arbitrary template.
Constructors:
AnyTemplate
Any
- instance
EqAnyTemplate - instance
OrdAnyTemplate
data TemplateTypeRep
Unique textual representation of a template Id.
Constructors:
TemplateTypeRep
TypeRep
- instance
EqTemplateTypeRep - instance
OrdTemplateTypeRep
data Down a
The Down type can be used for reversing sorting order.
For example, sortOn (\x -> Down x.field) would sort by descending field.
Constructors:
Down a
- instance
ActionDown - instance
ApplicativeDown - instance
FunctorDown - instance
Eqa=>Eq(Downa) - instance
Orda=>Ord(Downa) - instance
Showa=>Show(Downa)
type Implements t i
= (HasInterfaceTypeRep i, HasToInterface t i, HasFromInterface t i)
(Daml-LF >= 1.15) Constraint that indicates that a template implements an interface.
data AnyException
A wrapper for all exception types.
Instances:
- instance
HasFromAnyExceptionAnyException - instance
HasMessageAnyException - instance
HasToAnyExceptionAnyException
data ContractId a
The ContractId a type represents an ID for a contract created from a template a.
You can use the ID to fetch the contract, among other things.
Instances:
- instance
Serializable(ContractIda) - instance
Eq(ContractIda) - instance
Ord(ContractIda) - instance
Show(ContractIda)
data Date
The Date type represents a date, for example date 2007 Apr 5.
The bounds for Date are 0001-01-01 and 9999-12-31.
Instances:
- instance
SerializableDate - instance
EqDate - instance
OrdDate - instance
BoundedDate - instance
EnumDate - instance
ShowDate
data Map a b
The Map a b type represents an associative array from keys of type a
to values of type b. It uses the built-in equality for keys. Import
DA.Map to use it.
Instances:
- instance
Ordk=>Foldable(Mapk) - instance
Ordk=>Monoid(Mapkv) - instance
Ordk=>Semigroup(Mapkv) - instance
GetFieldmap(Setk) (Mapk()) - instance
SetFieldmap(Setk) (Mapk()) - instance
Ordk=>Traversable(Mapk) - instance (
Serializablea,Serializableb) =>Serializable(Mapab) - instance
Ordk=>Functor(Mapk) - instance (
Ordk,Eqv) =>Eq(Mapkv) - instance (
Ordk,Ordv) =>Ord(Mapkv) - instance (
Showk,Showv) =>Show(Mapkv)
data Party
The Party type represents a party to a contract.
Instances:
- instance
HasFromHex(OptionalParty) - instance
HasToHexParty - instance
IsPartiesParty - instance
IsParties(OptionalParty) - instance
IsParties(NonEmptyParty) - instance
IsParties(SetParty) - instance
IsParties[Party] - instance
SerializableParty - instance
EqParty - instance
OrdParty - instance
ShowParty
data TextMap a
The TextMap a type represents an associative array from keys of type
Text to values of type a.
Instances:
- instance
FoldableTextMap - instance
Monoid(TextMapb) - instance
Semigroup(TextMapb) - instance
GetFieldmetaFailureStatus(TextMapText) - instance
SetFieldmetaFailureStatus(TextMapText) - instance
TraversableTextMap - instance
Serializablea=>Serializable(TextMapa) - instance
FunctorTextMap - instance
Eqa=>Eq(TextMapa) - instance
Orda=>Ord(TextMapa) - instance
Showa=>Show(TextMapa)
data Time
The Time type represents a specific datetime in UTC,
for example time (date 2007 Apr 5) 14 30 05.
The bounds for Time are 0001-01-01T00:00:00.000000Z and
9999-12-31T23:59:59.999999Z.
Instances:
- instance
SerializableTime - instance
EqTime - instance
OrdTime - instance
BoundedTime - instance
ShowTime
data Update a
The Update a type represents an Action to update or query the ledger,
before returning a value of type a. Examples include create and fetch.
Instances:
- instance
CanAssertUpdate - instance
ActionCatchUpdate - instance
ActionThrowUpdate - instance
ActionFailWithStatusUpdate - instance
CanAbortUpdate - instance
HasTimeUpdate - instance
ActionUpdate - instance
ActionFailUpdate - instance
ApplicativeUpdate - instance
FunctorUpdate
data Optional a
The Optional type encapsulates an optional value. A value of type
Optional a either contains a value of type a (represented as Some a),
or it is empty (represented as None). Using Optional is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as error.
The Optional type is also an Action. It is a simple kind of error
Action, where all errors are represented by None. A richer
error Action could be built using the Data.Either.Either type.
Constructors:
None
Some a
- instance
HasFromHex(OptionalParty) - instance
HasFromHex(OptionalInt) - instance
HasFromHex(OptionalText) - instance
FoldableOptional - instance
ActionOptional - instance
ActionFailOptional - instance
ApplicativeOptional - instance
IsParties(OptionalParty) - instance
TraversableOptional - instance
Serializablea=>Serializable(Optionala) - instance
FunctorOptional - instance
Eqa=>Eq(Optionala) - instance
Orda=>Ord(Optionala) - instance
Showa=>Show(Optionala)
data Archive
The data type corresponding to the implicit Archive
choice in every template.
Constructors:
Archive
type Choice t c r
= (Template t, HasExercise t c r, HasToAnyChoice t c r, HasFromAnyChoice t c r)
Constraint satisfied by choices.
type Template t
= (HasTemplateTypeRep t, HasToAnyTemplate t, HasFromAnyTemplate t)
type TemplateKey t k
= (Template t, HasKey t k, HasFetchByKey t k, HasMaintainer t k)
Constraint satisfied by template keys.
data Either a b
The Either type represents values with two possibilities: a value of
type Either a b is either Left a or Right b.
The Either type is sometimes used to represent a value which is
either correct or an error; by convention, the Left constructor is
used to hold an error value and the Right constructor is used to
hold a correct value (mnemonic: “right” also means “correct”).
Constructors:
Left a
Right b
- instance (
Eqa,Eqb) =>Eq(Eitherab) - instance (
Orda,Ordb) =>Ord(Eitherab) - instance (
Showa,Showb) =>Show(Eitherab)
type ShowS
= Text -> Text
showS should represent some text, and applying it to some argument
should prepend the argument to the represented text.
data Bool
A type for Boolean values, ie True and False.
Constructors:
False
True
type Decimal
= Numeric 10
data Int
A type representing a 64-bit integer.
Instances:
- instance
EqInt - instance
OrdInt - instance
BoundedInt - instance
EnumInt - instance
AdditiveInt - instance
DivisibleInt - instance
MultiplicativeInt - instance
NumberInt - instance
SignedInt - instance
ShowInt
data Nat
(Kind) This is the kind of type-level naturals.
data Numeric n
A type for fixed-point decimal numbers, with the scale
being passed as part of the type.
Numeric n represents a fixed-point decimal number with a
fixed precision of 38 (i.e. 38 digits not including a leading zero)
and a scale of n, i.e., n digits after the decimal point.
n must be between 0 and 37 (bounds inclusive).
Examples:
- instance
Eq(Numericn) - instance
Ord(Numericn) - instance
NumericScalen=>Additive(Numericn) - instance
NumericScalen=>Divisible(Numericn) - instance
NumericScalen=>Fractional(Numericn) - instance
NumericScalen=>Multiplicative(Numericn) - instance
NumericScalen=>Number(Numericn) - instance
NumericScalen=>Signed(Numericn) - instance
Show(Numericn)
data Ordering
A type for giving information about ordering:
being less than (LT), equal to (EQ), or greater than
(GT) something.
Constructors:
LT
EQ
GT
data Text
A type for text strings, that can represent any unicode code point.
For example "Hello, world".
Instances:
data [] a
A type for lists, for example [1,2,3].
Constructors:
[]
: _ _
Typeclasses
class Action m => CanAssert m
Constraint that determines whether an assertion can be made
in this context.
Methods:
assertFail:Text->mtAbort since an assertion has failed. In an Update, Scenario, or Script context this will throw an AssertionFailed exception. In anEither Textcontext, this will return the message as an error.
class HasInterfaceTypeRep i
(Daml-LF >= 1.15) Exposes the interfaceTypeRep function. Available only for interfaces.
class HasToInterface t i
(Daml-LF >= 1.15) Exposes the toInterface and toInterfaceContractId functions.
class HasFromInterface t i
(Daml-LF >= 1.15) Exposes fromInterface and fromInterfaceContractId
functions.
Methods:
-
fromInterface:i->Optionalt(Daml-LF >= 1.15) Attempt to convert an interface value back into a template value. ANoneindicates that the expected template type doesn’t match the underyling template type for the interface value. For example,fromInterface @MyTemplate valuewill try to convert the interface valuevalueinto the template typeMyTemplate.
class HasInterfaceView i v
Methods:
_view:i->v
class HasTime m
The HasTime class is for where the time is available: Update
Methods:
getTime:HasCallStack=>mTimeGet the current time.
class Action m => CanAbort m
The CanAbort class is for Action s that can be aborted.
Methods:
abort:Text->maAbort the current action with a message.
class Functor f => Applicative f
Methods:
-
pure:a->faLift a value. -
<*>:f(a->b) ->fa->fbSequentially apply the function. A few functors support an implementation of<*>that is more efficient than the default one. -
liftA2: (a->b->c) ->fa->fb->fcLift a binary function to actions. Some functors support an implementation ofliftA2that is more efficient than the default one. In particular, iffmapis an expensive operation, it is likely better to useliftA2than tofmapover the structure and then use<*>. -
*>:fa->fb->fbSequence actions, discarding the value of the first argument. -
<*:fa->fb->faSequence actions, discarding the value of the second argument.
- instance
Applicative(->r) - instance
Applicative(States) - instance
ApplicativeDown - instance
ApplicativeUpdate - instance
ApplicativeOptional - instance
ApplicativeFormula - instance
ApplicativeNonEmpty - instance
Applicative(Validationerr) - instance
Applicative(Eithere) - instance
Applicative[]
class Applicative m => Action m
Methods:
>>=:ma-> (a->mb) ->mbSequentially compose two actions, passing any value produced by the first as an argument to the second.
- instance
Action(->r) - instance
Action(States) - instance
ActionDown - instance
ActionUpdate - instance
ActionOptional - instance
ActionFormula - instance
ActionNonEmpty - instance
Action(Eithere) - instance
Action[]
class Action m => ActionFail m
This class exists to desugar pattern matches in do-notation.
Polymorphic usage, or calling fail directly, is not recommended.
Instead consider using CanAbort.
Methods:
fail:Text->maFail with an error message.
- instance
ActionFailUpdate - instance
ActionFailOptional - instance
ActionFail(EitherText) - instance
ActionFail[]
class Semigroup a
The class of semigroups (types with an associative binary operation).
Methods:
<>:a->a->aAn associative operation.
- instance
Ordk=>Semigroup(Mapkv) - instance
Semigroup(TextMapb) - instance
SemigroupAll - instance
SemigroupAny - instance
Semigroup(Endoa) - instance
Multiplicativea=>Semigroup(Producta) - instance
Additivea=>Semigroup(Suma) - instance
Semigroup(NonEmptya) - instance
Orda=>Semigroup(Maxa) - instance
Orda=>Semigroup(Mina) - instance
Ordk=>Semigroup(Setk) - instance
Semigroup(Validationerra) - instance
SemigroupOrdering - instance
SemigroupText - instance
Semigroup[a]
class Semigroup a => Monoid a
The class of monoids (types with an associative binary operation that has an identity).
Methods:
mempty:aIdentity of(<>)mconcat: [a] ->aFold a list using the monoid. For example usingmconcaton a list of strings would concatenate all strings to one lone string.
- instance
Ordk=>Monoid(Mapkv) - instance
Monoid(TextMapb) - instance
MonoidAll - instance
MonoidAny - instance
Monoid(Endoa) - instance
Multiplicativea=>Monoid(Producta) - instance
Additivea=>Monoid(Suma) - instance
Ordk=>Monoid(Setk) - instance
MonoidOrdering - instance
MonoidText - instance
Monoid[a]
class HasSignatory t
Exposes signatory function. Part of the Template constraint.
Methods:
signatory:t-> [Party] The signatories of a contract.
class HasObserver t
Exposes observer function. Part of the Template constraint.
Methods:
observer:t-> [Party] The observers of a contract.
class HasEnsure t
Exposes ensure function. Part of the Template constraint.
Methods:
ensure:t->BoolA predicate that must be true, otherwise contract creation will fail.
class HasCreate t
Exposes create function. Part of the Template constraint.
Methods:
create:t->Update(ContractIdt) Create a contract based on a templatet.
class HasFetch t
Exposes fetch function. Part of the Template constraint.
Methods:
fetch:ContractIdt->UpdatetFetch the contract data associated with the given contract ID. If theContractId tsupplied is not the contract ID of an active contract, this fails and aborts the entire transaction.
class HasSoftFetch t
Exposes softFetch function
class HasSoftExercise t c r
class HasArchive t
Exposes archive function. Part of the Template constraint.
Methods:
archive:ContractIdt->Update() Archive the contract with the given contract ID.
class HasTemplateTypeRep t
Exposes templateTypeRep function in Daml-LF 1.7 or later.
Part of the Template constraint.
class HasToAnyTemplate t
Exposes toAnyTemplate function in Daml-LF 1.7 or later.
Part of the Template constraint.
class HasFromAnyTemplate t
Exposes fromAnyTemplate function in Daml-LF 1.7 or later.
Part of the Template constraint.
class HasExercise t c r
Exposes exercise function. Part of the Choice constraint.
Methods:
exercise:ContractIdt->c->UpdaterExercise a choice on the contract with the given contract ID.
class HasChoiceController t c
Exposes choiceController function. Part of the Choice constraint.
class HasChoiceObserver t c
Exposes choiceObserver function. Part of the Choice constraint.
class HasExerciseGuarded t c r
(1.dev only) Exposes exerciseGuarded function.
Only available for interface choices.
Methods:
exerciseGuarded: (t->Bool) ->ContractIdt->c->Updater(1.dev only) Exercise a choice on the contract with the given contract ID, only if the predicate returnsTrue.
class HasToAnyChoice t c r
Exposes toAnyChoice function for Daml-LF 1.7 or later.
Part of the Choice constraint.
class HasFromAnyChoice t c r
Exposes fromAnyChoice function for Daml-LF 1.7 or later.
Part of the Choice constraint.
class HasKey t k
Exposes key function. Part of the TemplateKey constraint.
Methods:
key:t->kThe key of a contract.
class HasLookupByKey t k
Exposes lookupByKey function. Part of the TemplateKey constraint.
class HasFetchByKey t k
Exposes fetchByKey function. Part of the TemplateKey constraint.
class HasLookupNByKey t k
class HasMaintainer t k
Exposes maintainer function. Part of the TemplateKey constraint.
class HasExerciseByKey t k c r
Exposes exerciseByKey function.
class IsParties a
Accepted ways to specify a list of parties: either a single party, or a list of parties.
Methods:
toParties:a-> [Party] Convert to list of parties.
- instance
IsPartiesParty - instance
IsParties(OptionalParty) - instance
IsParties(NonEmptyParty) - instance
IsParties(SetParty) - instance
IsParties[Party]
class Functor f
A Functor is a typeclass for things that can be mapped over (using
its fmap function. Examples include Optional, [] and Update).
Methods:
-
fmap: (a->b) ->fa->fbfmaptakes a function of typea -> b, and turns it into a function of typef a -> f b, wherefis the type which is an instance ofFunctor. For example,mapis anfmapthat only works on lists. It takes a functiona -> band a[a], and returns a[b]. -
<$:a->fb->faReplace all locations in the inputf bwith the same valuea. The default definition isfmap . const, but you can override this with a more efficient version.
class Eq a
The Eq class defines equality (==) and inequality (/=).
All the basic datatypes exported by the “Prelude” are instances of Eq,
and Eq may be derived for any datatype whose constituents are also
instances of Eq.
Usually, == is expected to implement an equivalence relationship where two
values comparing equal are indistinguishable by “public” functions, with
a “public” function being one not allowing to see implementation details. For
example, for a type representing non-normalised natural numbers modulo 100,
a “public” function doesn’t make the difference between 1 and 201. It is
expected to have the following properties:
Reflexivity: x == x = True
Symmetry: x == y = y == x
Transitivity: if x == y && y == z = True, then x == z = True
Substitutivity: if x == y = True and f is a “public” function
whose return type is an instance of Eq, then f x == f y = True
Negation: x /= y = not (x == y)
Minimal complete definition: either == or /=.
Methods:
Instances:
- instance (
Eqa,Eqb) =>Eq(Eitherab) - instance
EqBool - instance
EqInt - instance
Eq(Numericn) - instance
EqOrdering - instance
EqText - instance
Eqa=>Eq[a] - instance
Eq() - instance (
Eqa,Eqb) =>Eq(a,b) - instance (
Eqa,Eqb,Eqc) =>Eq(a,b,c) - instance (
Eqa,Eqb,Eqc,Eqd) =>Eq(a,b,c,d) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe) =>Eq(a,b,c,d,e) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf) =>Eq(a,b,c,d,e,f) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg) =>Eq(a,b,c,d,e,f,g) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh) =>Eq(a,b,c,d,e,f,g,h) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi) =>Eq(a,b,c,d,e,f,g,h,i) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj) =>Eq(a,b,c,d,e,f,g,h,i,j) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk) =>Eq(a,b,c,d,e,f,g,h,i,j,k) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql) =>Eq(a,b,c,d,e,f,g,h,i,j,k,l) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql,Eqm) =>Eq(a,b,c,d,e,f,g,h,i,j,k,l,m) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql,Eqm,Eqn) =>Eq(a,b,c,d,e,f,g,h,i,j,k,l,m,n) - instance (
Eqa,Eqb,Eqc,Eqd,Eqe,Eqf,Eqg,Eqh,Eqi,Eqj,Eqk,Eql,Eqm,Eqn,Eqo) =>Eq(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
class Eq a => Ord a
The Ord class is used for totally ordered datatypes.
Instances of Ord can be derived for any user-defined datatype whose
constituent types are in Ord. The declared order of the constructors in
the data declaration determines the ordering in derived Ord instances. The
Ordering datatype allows a single comparison to determine the precise
ordering of two objects.
The Haskell Report defines no laws for Ord. However, <= is customarily
expected to implement a non-strict partial order and have the following
properties:
Transitivity: if x <= y && y <= z = True, then x <= z = True
Reflexivity: x <= x = True
Antisymmetry: if x <= y && y <= x = True, then x == y = True
Note that the following operator interactions are expected to hold:
x >= y=y <= xx < y=x <= y && x /= yx > y=y < xx < y=compare x y == LTx > y=compare x y == GTx == y=compare x y == EQmin x y == if x <= y then x else y= ‘True’max x y == if x >= y then x else y= ‘True’
compare or <=.
Using compare can be more efficient for complex types.
Methods:
compare:a->a->Ordering<:a->a->Bool<=:a->a->Bool>:a->a->Bool>=:a->a->Boolmax:a->a->amin:a->a->a
- instance (
Orda,Ordb) =>Ord(Eitherab) - instance
OrdBool - instance
OrdInt - instance
Ord(Numericn) - instance
OrdOrdering - instance
OrdText - instance
Orda=>Ord[a] - instance
Ord() - instance (
Orda,Ordb) =>Ord(a,b) - instance (
Orda,Ordb,Ordc) =>Ord(a,b,c) - instance (
Orda,Ordb,Ordc,Ordd) =>Ord(a,b,c,d) - instance (
Orda,Ordb,Ordc,Ordd,Orde) =>Ord(a,b,c,d,e) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf) =>Ord(a,b,c,d,e,f) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg) =>Ord(a,b,c,d,e,f,g) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh) =>Ord(a,b,c,d,e,f,g,h) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi) =>Ord(a,b,c,d,e,f,g,h,i) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj) =>Ord(a,b,c,d,e,f,g,h,i,j) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk) =>Ord(a,b,c,d,e,f,g,h,i,j,k) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl) =>Ord(a,b,c,d,e,f,g,h,i,j,k,l) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl,Ordm) =>Ord(a,b,c,d,e,f,g,h,i,j,k,l,m) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl,Ordm,Ordn) =>Ord(a,b,c,d,e,f,g,h,i,j,k,l,m,n) - instance (
Orda,Ordb,Ordc,Ordd,Orde,Ordf,Ordg,Ordh,Ordi,Ordj,Ordk,Ordl,Ordm,Ordn,Ordo) =>Ord(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o)
class NumericScale n
Is this a valid scale for the Numeric type?
This typeclass is used to prevent the creation of Numeric values
with too large a scale. The scale controls the number of digits available
after the decimal point, and it must be between 0 and 37 inclusive.
Thus the only available instances of this typeclass are NumericScale 0
through NumericScale 37. This cannot be extended without additional
compiler and runtime support. You cannot implement a custom instance
of this typeclass.
If you have an error message in your code of the form “No instance for
(NumericScale n)”, this is probably caused by having a numeric literal
whose scale cannot be inferred by the compiler. You can usually fix this
by adding a type signature to the definition, or annotating the numeric
literal directly (for example, instead of writing 3.14159 you can write
(3.14159 : Numeric 5)).
Methods:
numericScale:IntGet the scale of aNumericas an integer. For example,numericScale (3.14159 : Numeric 5)equals5.numericOne:Numericn1 with scale n
- instance
NumericScale0 - instance
NumericScale1 - instance
NumericScale10 - instance
NumericScale11 - instance
NumericScale12 - instance
NumericScale13 - instance
NumericScale14 - instance
NumericScale15 - instance
NumericScale16 - instance
NumericScale17 - instance
NumericScale18 - instance
NumericScale19 - instance
NumericScale2 - instance
NumericScale20 - instance
NumericScale21 - instance
NumericScale22 - instance
NumericScale23 - instance
NumericScale24 - instance
NumericScale25 - instance
NumericScale26 - instance
NumericScale27 - instance
NumericScale28 - instance
NumericScale29 - instance
NumericScale3 - instance
NumericScale30 - instance
NumericScale31 - instance
NumericScale32 - instance
NumericScale33 - instance
NumericScale34 - instance
NumericScale35 - instance
NumericScale36 - instance
NumericScale37 - instance
NumericScale4 - instance
NumericScale5 - instance
NumericScale6 - instance
NumericScale7 - instance
NumericScale8 - instance
NumericScale9
class Bounded a
Use the Bounded class to name the upper and lower limits of a
type.
You can derive an instance of the Bounded class for any enumeration
type. minBound is the first constructor listed in the data
declaration and maxBound is the last.
You can also derive an instance of Bounded for single-constructor data types whose
constituent types are in Bounded.
Ord is not a superclass of Bounded because types that are not
totally ordered can still have upper and lower bounds.
Methods:
minBound:amaxBound:a
class Enum a
Use the Enum class to define operations on sequentially ordered
types: that is, types that can be enumerated. Enum members have
defined successors and predecessors, which you can get with the succ
and pred functions.
Types that are an instance of class Bounded as well as Enum
should respect the following laws:
-
Both
succ maxBoundandpred minBoundshould result in a runtime error. -
fromEnumandtoEnumshould give a runtime error if the result value is not representable in the result type. For example,toEnum 7 : Boolis an error. -
enumFromandenumFromThenshould be defined with an implicit bound, like this:
-
succ:a->aReturns the successor of the given value. For example, for numeric types,succadds 1. If the type is also an instance ofBounded,succ maxBoundresults in a runtime error. -
pred:a->aReturns the predecessor of the given value. For example, for numeric types,predsubtracts 1. If the type is also an instance ofBounded,pred minBoundresults in a runtime error. -
toEnum:Int->aConvert a value from anIntto anEnumvalue: ie,toEnum ireturns the item at theith position of (the instance of)Enum -
fromEnum:a->IntConvert a value from anEnumvalue to anInt: ie, returns theIntposition of the element within theEnum. IffromEnumis applied to a value that’s too large to fit in anInt, what is returned is up to your implementation. -
enumFrom:a-> [a] Return a list of theEnumvalues starting at theIntposition. For example:enumFrom 6 : [Int] = [6,7,8,9,...,maxBound : Int]
-
enumFromThen:a->a-> [a] Returns a list of theEnumvalues with the first value at the firstIntposition, the second value at the secondIntposition, and further values with the same distance between them. For example:enumFromThen 4 6 : [Int] = [4,6,8,10...]enumFromThen 6 2 : [Int] = [6,2,-2,-6,...,minBound :: Int]
-
enumFromTo:a->a-> [a] Returns a list of theEnumvalues with the first value at the firstIntposition, and the last value at the lastIntposition. This is what’s behind the language feature that lets you write[n,m..]. For example:enumFromTo 6 10 : [Int] = [6,7,8,9,10]
-
enumFromThenTo:a->a->a-> [a] Returns a list of theEnumvalues with the first value at the firstIntposition, the second value at the secondIntposition, and further values with the same distance between them, with the final value at the finalIntposition. This is what’s behind the language feature that lets you write[n,n'..m]. For example:enumFromThenTo 4 2 -6 : [Int] = [4,2,0,-2,-4,-6]enumFromThenTo 6 8 2 : [Int] = []
class Additive a
Use the Additive class for types that can be added.
Instances have to respect the following laws:
(+)must be associative, ie:(x + y) + z=x + (y + z)(+)must be commutative, ie:x + y=y + xx + aunit=xnegategives the additive inverse, ie:x + negate x=aunit
+:a->a->aAdd the two arguments together.aunit:aThe additive identity for the type. For example, for numbers, this is 0.-:a->a->aSubtract the second argument from the first argument, ie.x - y=x + negate ynegate:a->aNegate the argument:x + negate x=aunit
- instance
AdditiveInt - instance
NumericScalen=>Additive(Numericn)
class Multiplicative a
Use the Multiplicative class for types that can be multiplied.
Instances have to respect the following laws:
(*)is associative, ie:(x * y) * z=x * (y * z)(*)is commutative, ie:x * y=y * xx * munit=x
*:a->a->aMultipy the arguments togethermunit:aThe multiplicative identity for the type. For example, for numbers, this is 1.^:a->Int->ax ^ nraisesxto the power ofn.
- instance
MultiplicativeInt - instance
NumericScalen=>Multiplicative(Numericn)
class (Additive a, Multiplicative a) => Number a
Number is a class for numerical types.
As well as the rules for Additive and Multiplicative, instances
also have to respect the following law:
(*)is distributive with respect to(+). That is:a * (b + c)=(a * b) + (a * c)and(b + c) * a=(b * a) + (c * a)
- instance
NumberInt - instance
NumericScalen=>Number(Numericn)
class Signed a
The Signed is for the sign of a number.
Methods:
signum:a->aSign of a number. For real numbers, the ‘signum’ is either-1(negative),0(zero) or1(positive).abs:a->aThe absolute value: that is, the value without the sign.
- instance
SignedInt - instance
NumericScalen=>Signed(Numericn)
class Multiplicative a => Divisible a
Use the Divisible class for types that can be divided.
Instances should respect that division is the inverse of
multiplication, i.e. x * y / y is equal to x whenever
it is defined.
Methods:
/:a->a->ax / ydividesxbyy
- instance
DivisibleInt - instance
NumericScalen=>Divisible(Numericn)
class Divisible a => Fractional a
Use the Fractional class for types that can be divided
and where the reciprocal is well defined. Instances
have to respect the following laws:
-
When
recip xis defined, it must be the inverse ofxwith respect to multiplication:x * recip x = munit -
When
recip yis defined, thenx / y = x * recip y
recip:a->aCalculates the reciprocal:recip xis1/x.
- instance
NumericScalen=>Fractional(Numericn)
class Show a
Use the Show class for values that can be converted to a
readable Text value.
Derived instances of Show have the following properties:
-
The result of
showis a syntactically correct expression that only contains constants (given the fixity declarations in force at the point where the type is declared). It only contains the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. -
If the constructor is defined to be an infix operator, then
showsPrecproduces infix applications of the constructor. -
If the precedence of the top-level constructor in
xis less thand(associativity is ignored), the representation will be enclosed in parentheses. For example, ifdis0then the result is never surrounded in parentheses; ifdis11it is always surrounded in parentheses, unless it is an atomic expression. -
If the constructor is defined using record syntax, then
showwill produce the record-syntax form, with the fields given in the same order as the original declaration.
showsPrec:Int->a->ShowSConvert a value to a readableTextvalue. Unlikeshow,showsPrecshould satisfy the ruleshowsPrec d x r ++ s == showsPrec d x (r ++ s)show:a->TextConvert a value to a readableTextvalue.showList: [a] ->ShowSAllows you to show lists of values.
- instance (
Showa,Showb) =>Show(Eitherab) - instance
ShowBool - instance
ShowInt - instance
Show(Numericn) - instance
ShowOrdering - instance
ShowText - instance
Showa=>Show[a] - instance
Show() - instance (
Showa,Showb) =>Show(a,b) - instance (
Showa,Showb,Showc) =>Show(a,b,c) - instance (
Showa,Showb,Showc,Showd) =>Show(a,b,c,d) - instance (
Showa,Showb,Showc,Showd,Showe) =>Show(a,b,c,d,e)
Functions
assert
assert : CanAssert m => Bool -> m ()
Check whether a condition is true. If it’s not, abort the transaction.
assertMsg
assertMsg : CanAssert m => Text -> Bool -> m ()
Check whether a condition is true. If it’s not, abort the transaction
with a message.
assertAfter
assertAfter : (CanAssert m, HasTime m) => Time -> m ()
Check whether the given time is in the future. If it’s not, abort the transaction.
assertBefore
assertBefore : (CanAssert m, HasTime m) => Time -> m ()
Check whether the given time is in the past. If it’s not, abort the transaction.
daysSinceEpochToDate
daysSinceEpochToDate : Int -> Date
Convert from number of days since epoch (i.e. the number of days since
January 1, 1970) to a date.
dateToDaysSinceEpoch
dateToDaysSinceEpoch : Date -> Int
Convert from a date to number of days from epoch (i.e. the number of days
since January 1, 1970).
interfaceTypeRep
interfaceTypeRep : HasInterfaceTypeRep i => i -> TemplateTypeRep
(Daml-LF >= 1.15) Obtain the TemplateTypeRep for the template given in the interface value.
toInterface
toInterface : HasToInterface t i => t -> i
(Daml-LF >= 1.15) Convert a template value into an interface value.
For example toInterface @MyInterface value converts a template
value into a MyInterface type.
toInterfaceContractId
toInterfaceContractId : HasToInterface t i => ContractId t -> ContractId i
(Daml-LF >= 1.15) Convert a template contract id into an interface
contract id. For example, toInterfaceContractId @MyInterface cid.
fromInterfaceContractId
fromInterfaceContractId : HasFromInterface t i => ContractId i -> ContractId t
(Daml-LF >= 1.15) Convert an interface contract id into a template
contract id. For example, fromInterfaceContractId @MyTemplate cid.
Can also be used to convert an interface contract id into a contract id of
one of its requiring interfaces.
This function does not verify that the interface contract id
actually points to a template of the given type. This means
that a subsequent fetch, exercise, or archive may fail, if,
for example, the contract id points to a contract that implements
the interface but is of a different template type than expected.
Therefore, you should only use fromInterfaceContractId in situations
where you already know that the contract id points to a contract of the
right template type. You can also use it in situations where you will
fetch, exercise, or archive the contract right away, when a transaction
failure is the appropriate response to the contract having the wrong
template type.
In all other cases, consider using fetchFromInterface instead.
coerceInterfaceContractId
coerceInterfaceContractId : (HasInterfaceTypeRep i, HasInterfaceTypeRep j) => ContractId i -> ContractId j
(Daml-LF >= 1.15) Convert an interface contract id into a contract id of a
different interface. For example, given two interfaces Source and Target,
and cid : ContractId Source,
coerceInterfaceContractId @Target @Source cid : ContractId Target.
This function does not verify that the contract id
actually points to a contract that implements either interface. This means
that a subsequent fetch, exercise, or archive may fail, if,
for example, the contract id points to a contract of template A but it was
coerced into a ContractId B where B is an interface and there’s no
interface instance B for A.
Therefore, you should only use coerceInterfaceContractId in situations
where you already know that the contract id points to a contract of the right
type. You can also use it in situations where you will fetch, exercise, or
archive the contract right away, when a transaction failure is the
appropriate response to the contract having the wrong type.
fetchFromInterface
fetchFromInterface : (HasFromInterface t i, HasFetch i) => ContractId i -> Update (Optional (ContractId t, t))
(Daml-LF >= 1.15) Fetch an interface and convert it to a specific
template type. If conversion is succesful, this function returns
the converted contract and its converted contract id. Otherwise,
this function returns None.
Can also be used to fetch and convert an interface contract id into a
contract and contract id of one of its requiring interfaces.
Example:
_exerciseInterfaceGuard
_exerciseInterfaceGuard : a -> b -> c -> Bool
view
view : HasInterfaceView i v => i -> v
partyToText
partyToText : Party -> Text
Convert the Party to Text, giving back what you passed to getParty.
In most cases, you should use show instead. show wraps
the party in 'ticks' making it clear it was a Party originally.
partyFromText
partyFromText : Text -> Optional Party
Converts a Text to Party. It returns None if the provided text contains
any forbidden characters. See Daml-LF spec for a specification on which characters
are allowed in parties. Note that this function accepts text without
single quotes.
This function does not check on whether the provided
text corresponds to a party that “exists” on a given ledger: it merely converts
the given Text to a Party. The only way to guarantee that a given Party
exists on a given ledger is to involve it in a contract.
This function, together with partyToText, forms an isomorphism between
valid party strings and parties. In other words, the following equations hold:
coerceContractId
coerceContractId : ContractId a -> ContractId b
Used to convert the type index of a ContractId, since they are just
pointers. Note that subsequent fetches and exercises might fail if the
template of the contract on the ledger doesn’t match.
curry
curry : ((a, b) -> c) -> a -> b -> c
Turn a function that takes a pair into a function that takes two arguments.
uncurry
uncurry : (a -> b -> c) -> (a, b) -> c
Turn a function that takes two arguments into a function that takes a pair.
>>
>> : Action m => m a -> m b -> m b
Sequentially compose two actions, discarding any value produced
by the first. This is like sequencing operators (such as the semicolon)
in imperative languages.
ap
ap : Applicative f => f (a -> b) -> f a -> f b
Synonym for <*>.
return
return : Applicative m => a -> m a
Inject a value into the monadic type. For example, for Update and a
value of type a, return would give you an Update a.
join
join : Action m => m (m a) -> m a
Collapses nested actions into a single action.
identity
identity : a -> a
The identity function.
guard
guard : ActionFail m => Bool -> m ()
foldl
foldl : (b -> a -> b) -> b -> [a] -> b
This function is a left fold, which you can use to inspect/analyse/consume lists.
foldl f i xs performs a left fold over the list xs using
the function f, using the starting value i.
Examples:
find
find : (a -> Bool) -> [a] -> Optional a
find p xs finds the first element of the list xs where the
predicate p is true. There might not be such an element, which
is why this function returns an Optional a.
length
length : [a] -> Int
Gives the length of the list.
any
any : (a -> Bool) -> [a] -> Bool
Are there any elements in the list where the predicate is true?
any p xs is True if p holds for at least one element of xs.
all
all : (a -> Bool) -> [a] -> Bool
Is the predicate true for all of the elements in the list?
all p xs is True if p holds for every element of xs.
or
or : [Bool] -> Bool
Is at least one of elements in a list of Bool true?
or bs is True if at least one element of bs is True.
and
and : [Bool] -> Bool
Is every element in a list of Bool true?
and bs is True if every element of bs is True.
elem
elem : Eq a => a -> [a] -> Bool
Does this value exist in this list?
elem x xs is True if x is an element of the list xs.
notElem
notElem : Eq a => a -> [a] -> Bool
Negation of elem:
elem x xs is True if x is not an element of the list xs.
<$>
<$> : Functor f => (a -> b) -> f a -> f b
Synonym for fmap.
optional
optional : b -> (a -> b) -> Optional a -> b
The optional function takes a default value, a function, and a Optional
value. If the Optional value is None, the function returns the
default value. Otherwise, it applies the function to the value inside
the Some and returns the result.
Basic usage examples:
show to a Optional Int. If you have Some n,
this shows the underlying Int, n. But if you have None, this
returns the empty string instead of (for example) None:
either
either : (a -> c) -> (b -> c) -> Either a b -> c
The either function provides case analysis for the Either type.
If the value is Left a, it applies the first function to a;
if it is Right b, it applies the second function to b.
Examples:
This example has two values of type Either [Int] Int, one using the
Left constructor and another using the Right constructor. Then
it applies either the length function (if it has a [Int])
or the “times-two” function (if it has an Int):
concat
concat : [[a]] -> [a]
Take a list of lists and concatenate those lists into one list.
++
++ : [a] -> [a] -> [a]
Concatenate two lists.
flip
flip : (a -> b -> c) -> b -> a -> c
Flip the order of the arguments of a two argument function.
reverse
reverse : [a] -> [a]
Reverse a list.
mapA
mapA : Applicative m => (a -> m b) -> [a] -> m [b]
Apply an applicative function to each element of a list.
forA
forA : Applicative m => [a] -> (a -> m b) -> m [b]
forA is mapA with its arguments flipped.
sequence
sequence : Applicative m => [m a] -> m [a]
Perform a list of actions in sequence and collect the results.
=<<
=<< : Action m => (a -> m b) -> m a -> m b
=<< is >>= with its arguments flipped.
concatMap
concatMap : (a -> [b]) -> [a] -> [b]
Map a function over each element of a list, and concatenate all the results.
replicate
replicate : Int -> a -> [a]
replicate i x gives the list [x, x, x, ..., x] with i copies of x.
take
take : Int -> [a] -> [a]
Take the first n elements of a list.
drop
drop : Int -> [a] -> [a]
Drop the first n elements of a list.
splitAt
splitAt : Int -> [a] -> ([a], [a])
Split a list at a given index.
takeWhile
takeWhile : (a -> Bool) -> [a] -> [a]
Take elements from a list while the predicate holds.
dropWhile
dropWhile : (a -> Bool) -> [a] -> [a]
Drop elements from a list while the predicate holds.
span
span : (a -> Bool) -> [a] -> ([a], [a])
span p xs is equivalent to (takeWhile p xs, dropWhile p xs).
partition
partition : (a -> Bool) -> [a] -> ([a], [a])
The partition function takes a predicate, a list and returns
the pair of lists of elements which do and do not satisfy the
predicate, respectively; i.e.,
partition p xs == (filter p xs, filter (not . p) xs)
break
break : (a -> Bool) -> [a] -> ([a], [a])
Break a list into two, just before the first element where the predicate holds.
break p xs is equivalent to span (not . p) xs.
lookup
lookup : Eq a => a -> [(a, b)] -> Optional b
Look up the first element with a matching key.
enumerate
enumerate : (Enum a, Bounded a) => [a]
Generate a list containing all values of a given enumeration.
zip
zip : [a] -> [b] -> [(a, b)]
zip takes two lists and returns a list of corresponding pairs.
If one list is shorter, the excess elements of the longer list are discarded.
zip3
zip3 : [a] -> [b] -> [c] -> [(a, b, c)]
zip3 takes three lists and returns a list of triples, analogous to zip.
zipWith
zipWith : (a -> b -> c) -> [a] -> [b] -> [c]
zipWith takes a function and two lists.
It generalises zip by combining elements using the function, instead of forming pairs.
If one list is shorter, the excess elements of the longer list are discarded.
zipWith3
zipWith3 : (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
zipWith3 generalises zip3 by combining elements using the function, instead of forming triples.
unzip
unzip : [(a, b)] -> ([a], [b])
Turn a list of pairs into a pair of lists.
unzip3
unzip3 : [(a, b, c)] -> ([a], [b], [c])
Turn a list of triples into a triple of lists.
traceRaw
traceRaw : Text -> a -> a
traceRaw msg a prints msg and returns a, for debugging purposes.
The default configuration on the participant logs these messages at DEBUG level.
trace
trace : Show b => b -> a -> a
trace b a prints b and returns a, for debugging purposes.
The default configuration on the participant logs these messages at DEBUG level.
traceId
traceId : Show b => b -> b
traceId a prints a and returns a, for debugging purposes.
The default configuration on the participant logs these messages at DEBUG level.
debug
debug : (Show b, Action m) => b -> m ()
debug x prints x for debugging purposes.
The default configuration on the participant logs these messages at DEBUG level.
debugRaw
debugRaw : Action m => Text -> m ()
debugRaw msg prints msg for debugging purposes.
The default configuration on the participant logs these messages at DEBUG level.
fst
fst : (a, b) -> a
Return the first element of a tuple.
snd
snd : (a, b) -> b
Return the second element of a tuple.
truncate
truncate : Numeric n -> Int
truncate x rounds x toward zero.
intToNumeric
intToNumeric : NumericScale n => Int -> Numeric n
Convert an Int to a Numeric.
intToDecimal
intToDecimal : Int -> Decimal
Convert an Int to a Decimal.
roundBankers
roundBankers : Int -> Numeric n -> Numeric n
Bankers’ Rounding: roundBankers dp x rounds x to dp decimal places, where a .5 is rounded to the nearest even digit.
roundCommercial
roundCommercial : NumericScale n => Int -> Numeric n -> Numeric n
Commercial Rounding: roundCommercial dp x rounds x to dp decimal places, where a .5 is rounded away from zero.
round
round : NumericScale n => Numeric n -> Int
Round a Numeric to the nearest integer, where a .5 is rounded away from zero.
floor
floor : NumericScale n => Numeric n -> Int
Round a Decimal down to the nearest integer.
ceiling
ceiling : NumericScale n => Numeric n -> Int
Round a Decimal up to the nearest integer.
null
null : [a] -> Bool
Is the list empty? null xs is true if xs is the empty list.
filter
filter : (a -> Bool) -> [a] -> [a]
Filters the list using the function: keep only the elements where the predicate holds.
sum
sum : Additive a => [a] -> a
Add together all the elements in the list.
product
product : Multiplicative a => [a] -> a
Multiply all the elements in the list together.
undefined
undefined : a
A convenience function that can be used to mark something not implemented.
Always throws an error with “Not implemented.”
softFetch
softFetch : HasSoftFetch t => ContractId t -> Update t
softExercise
softExercise : HasSoftExercise t c r => ContractId t -> c -> Update r
stakeholder
stakeholder : (HasSignatory t, HasObserver t) => t -> [Party]
The stakeholders of a contract: its signatories and observers.
maintainer
maintainer : HasMaintainer t k => k -> [Party]
The list of maintainers of a contract key.
lookupByKey
lookupByKey : (HasKey t k, HasLookupNByKey t k) => k -> Update (Optional (ContractId t))
Look up the contract ID t associated with a given contract key k (see
lookupNByKey for more on contract order).
You must pass the t using an explicit type application. For
instance, if you want to look up a contract of template Account by its
key k, you must call lookupByKey @Account k.
fetchByKey
fetchByKey : HasFetchByKey t k => k -> Update (ContractId t, t)
Fetch the first contract ID and contract data associated with the given
contract key (see lookupNByKey for more on contract order).
You must pass the t using an explicit type application. For
instance, if you want to fetch a contract of template Account by its
key k, you must call fetchByKey @Account k.
exerciseByKey
exerciseByKey : HasExerciseByKey t k c r => k -> c -> Update r
Exercise a choice on the first contract associated with the given key (see
lookupNByKey for more on contract order).
You must pass the t using an explicit type application. For
instance, if you want to exercise a choice Withdraw on a contract of
template Account given by its key k, you must call
exerciseByKey @Account k Withdraw.
createAndExercise
createAndExercise : (HasCreate t, HasExercise t c r) => t -> c -> Update r
Create a contract and exercise the choice on the newly created contract.
templateTypeRep
templateTypeRep : HasTemplateTypeRep t => TemplateTypeRep
Generate a unique textual representation of the template id.
toAnyTemplate
toAnyTemplate : HasToAnyTemplate t => t -> AnyTemplate
Wrap the template in AnyTemplate.
Only available for Daml-LF 1.7 or later.
fromAnyTemplate
fromAnyTemplate : HasFromAnyTemplate t => AnyTemplate -> Optional t
Extract the underlying template from AnyTemplate if the type matches
or return None.
Only available for Daml-LF 1.7 or later.
toAnyChoice
toAnyChoice : (HasTemplateTypeRep t, HasToAnyChoice t c r) => c -> AnyChoice
Wrap a choice in AnyChoice.
You must pass the template type t using an explicit type application.
For example toAnyChoice @Account Withdraw.
Only available for Daml-LF 1.7 or later.
fromAnyChoice
fromAnyChoice : (HasTemplateTypeRep t, HasFromAnyChoice t c r) => AnyChoice -> Optional c
Extract the underlying choice from AnyChoice if the template and
choice types match, or return None.
You must pass the template type t using an explicit type application.
For example fromAnyChoice @Account choice.
Only available for Daml-LF 1.7 or later.
visibleByKey
visibleByKey : (HasKey t k, HasLookupNByKey t k) => k -> Update Bool
True if contract exists, submitter is a stakeholder, and all maintainers
authorize. False if contract does not exist and all maintainers authorize.
Fails otherwise.
otherwise
otherwise : Bool
Used as an alternative in conditions.
map
map : (a -> b) -> [a] -> [b]
map f xs applies the function f to all elements of the list xs
and returns the list of results (in the same order as xs).
foldr
foldr : (a -> b -> b) -> b -> [a] -> b
This function is a right fold, which you can use to manipulate lists.
foldr f i xs performs a right fold over the list xs using
the function f, using the starting value i.
Note that foldr works from right-to-left over the list elements.
.
. : (b -> c) -> (a -> b) -> a -> c
Composes two functions, i.e., (f . g) x = f (g x).
const
const : a -> b -> a
const x is a unary function which evaluates to x for all inputs.
$
$ : (a -> b) -> a -> b
Take a function from a to b and a value of type a, and apply the
function to the value of type a, returning a value of type b.
This function has a very low precedence, which is why you might want to use
it instead of regular function application.
&&
&& : Bool -> Bool -> Bool
Boolean “and”.
This function has short-circuiting semantics, i.e., when both arguments are
present and the first arguments evaluates to ‘False’, the second argument
is not evaluated at all.
||
|| : Bool -> Bool -> Bool
Boolean “or”.
This function has short-circuiting semantics, i.e., when both arguments are
present and the first arguments evaluates to ‘True’, the second argument
is not evaluated at all.
not
not : Bool -> Bool
Boolean “not”
error
error : Text -> a
Throws a GeneralError exception.
subtract
subtract : Additive a => a -> a -> a
subtract x y is equivalent to y - x.
This is useful for partial application, e.g., in subtract 1 since (- 1) is
interpreted as the number -1 and not a function that subtracts 1 from
its argument.
modulo
% :Int -> Int -> Int
x % y calculates the remainder of x by y
shows
shows : Show a => a -> ShowS
showParen
showParen : Bool -> ShowS -> ShowS
Utility function that surrounds the inner show function with
parentheses when the ‘Bool’ parameter is ‘True’.
showString
showString : Text -> ShowS
Utility function converting a ‘String’ to a show function that
simply prepends the string unchanged.
showSpace
showSpace : ShowS
Prepends a single space to the front of the string.
showCommaSpace
showCommaSpace : ShowS
Prepends a comma and a single space to the front of the string.
Orphan Typeclass Instances
-
instance
Eqa=>Eq(Downa) -
instance
Showa=>Show(Downa) -
instance
FunctorDown -
instance
Functora -
instance
Functor[] -
instance
Functor(->r) -
instance
Functor(Eithere) -
instance
Orda=>Ord(Downa) -
instance
Serializablea=>Serializable[a] -
instance
SerializableInt -
instance
SerializableText -
instance
SerializableBool -
instance (
Serializablea,Serializableb) =>Serializable(Eitherab) -
instance
SerializableOrdering -
instance
Serializable(Numeric0) -
instance
Serializable(Numeric1) -
instance
Serializable(Numeric2) -
instance
Serializable(Numeric3) -
instance
Serializable(Numeric4) -
instance
Serializable(Numeric5) -
instance
Serializable(Numeric6) -
instance
Serializable(Numeric7) -
instance
Serializable(Numeric8) -
instance
Serializable(Numeric9) -
instance
Serializable(Numeric10) -
instance
Serializable(Numeric11) -
instance
Serializable(Numeric12) -
instance
Serializable(Numeric13) -
instance
Serializable(Numeric14) -
instance
Serializable(Numeric15) -
instance
Serializable(Numeric16) -
instance
Serializable(Numeric17) -
instance
Serializable(Numeric18) -
instance
Serializable(Numeric19) -
instance
Serializable(Numeric20) -
instance
Serializable(Numeric21) -
instance
Serializable(Numeric22) -
instance
Serializable(Numeric23) -
instance
Serializable(Numeric24) -
instance
Serializable(Numeric25) -
instance
Serializable(Numeric26) -
instance
Serializable(Numeric27) -
instance
Serializable(Numeric28) -
instance
Serializable(Numeric29) -
instance
Serializable(Numeric30) -
instance
Serializable(Numeric31) -
instance
Serializable(Numeric32) -
instance
Serializable(Numeric33) -
instance
Serializable(Numeric34) -
instance
Serializable(Numeric35) -
instance
Serializable(Numeric36) -
instance
Serializable(Numeric37) -
instance
Serializable() -
instance (
Serializablea,Serializableb) =>Serializable(a,b) -
instance (
Serializablea,Serializableb,Serializablec) =>Serializable(a,b,c) -
instance (
Serializablea,Serializableb,Serializablec,Serializabled) =>Serializable(a,b,c,d) -
instance (
Serializablea,Serializableb,Serializablec,Serializabled,Serializablee) =>Serializable(a,b,c,d,e) -
instance
Serializable(ContractIda) -
instance
Serializablea=>Serializable(TextMapa) -
instance (
Serializablea,Serializableb) =>Serializable(Mapab) -
instance
SerializableTime -
instance
SerializableDate -
instance
SerializableParty -
instance
SerializableGeneralError -
instance
SerializableAssertionFailed -
instance
SerializablePreconditionFailed -
instance
SerializableFailureCategory -
instance
SerializableFailureStatus -
instance
OrdTemplateTypeRep -
instance
EqArchive -
instance
ShowArchive -
instance
EqAnyTemplate -
instance
EqAnyChoice -
instance
EqAnyContractKey -
instance
OrdAnyTemplate -
instance
OrdAnyChoice -
instance
OrdAnyContractKey -
instance
EqTemplateTypeRep