Daml module
DA.Record
Exports the record machinery necessary to allow one to annotate
Daml
Data Types
type HasField x r a
= (GetField x r a, SetField x r a)
HasField is a class synonym for GetField and SetField, which
respectively give you getter and setter functions for each record field
automatically.
In the vast majority of use-cases, plain Record syntax should be
preferred:
For more on Record syntax, see https://docs.digitalasset.com/build/3.4/reference/daml/stdlib/DA-Record.html.
GetField x r a and SetField x r a are typeclasses taking three parameters. The first
parameter x is the field name, the second parameter r is the record type,
and the last parameter a is the type of the field in this record. For
example, if we define a type:
Then we get, for free, the following GetField and SetField instances:
If we want to get a value, we can use the getField method of class GetField:
Note that this uses the “type application” syntax ( f @t ) to specify the
field name.
Likewise, if we want to set the value in the field, we can use the setField method of class SetField:
Typeclasses
class GetField x r a
GetField x r a provides the getter part of HasField
Methods:
Instances:
- instance
GetField _1 (a, b) a
- instance
GetField _1 (a, b, c) a
- instance
GetField _1 (a, b, c, d) a
- instance
GetField _1 (a, b, c, d, e) a
- instance
GetField _2 (a, b) b
- instance
GetField _2 (a, b, c) b
- instance
GetField _2 (a, b, c, d) b
- instance
GetField _2 (a, b, c, d, e) b
- instance
GetField _3 (a, b, c) c
- instance
GetField _3 (a, b, c, d) c
- instance
GetField _3 (a, b, c, d, e) c
- instance
GetField _4 (a, b, c, d) d
- instance
GetField _4 (a, b, c, d, e) d
- instance
GetField _5 (a, b, c, d, e) e
- instance
GetField appEndo (Endo a) (a -> a)
- instance
GetField category FailureStatus FailureCategory
- instance
GetField errorId FailureStatus Text
- instance
GetField getAll All Bool
- instance
GetField getAny Any Bool
- instance
GetField getAnyView AnyView Any
- instance
GetField getAnyViewInterfaceTypeRep AnyView InterfaceTypeRep
- instance
GetField hd (NonEmpty a) a
- instance
GetField map (Set k) (Map k ())
- instance
GetField message FailureStatus Text
- instance
GetField message ArithmeticError Text
- instance
GetField message AssertionFailed Text
- instance
GetField message GeneralError Text
- instance
GetField message PreconditionFailed Text
- instance
GetField meta FailureStatus (TextMap Text)
- instance
GetField runState (State s a) (s -> (a, s))
- instance
GetField srcLocEndCol SrcLoc Int
- instance
GetField srcLocEndLine SrcLoc Int
- instance
GetField srcLocFile SrcLoc Text
- instance
GetField srcLocModule SrcLoc Text
- instance
GetField srcLocPackage SrcLoc Text
- instance
GetField srcLocStartCol SrcLoc Int
- instance
GetField srcLocStartLine SrcLoc Int
- instance
GetField tl (NonEmpty a) [a]
class SetField x r a
SetField x r a provides the setter part of HasField
Methods:
Instances:
- instance
SetField _1 (a, b) a
- instance
SetField _1 (a, b, c) a
- instance
SetField _1 (a, b, c, d) a
- instance
SetField _1 (a, b, c, d, e) a
- instance
SetField _2 (a, b) b
- instance
SetField _2 (a, b, c) b
- instance
SetField _2 (a, b, c, d) b
- instance
SetField _2 (a, b, c, d, e) b
- instance
SetField _3 (a, b, c) c
- instance
SetField _3 (a, b, c, d) c
- instance
SetField _3 (a, b, c, d, e) c
- instance
SetField _4 (a, b, c, d) d
- instance
SetField _4 (a, b, c, d, e) d
- instance
SetField _5 (a, b, c, d, e) e
- instance
SetField appEndo (Endo a) (a -> a)
- instance
SetField category FailureStatus FailureCategory
- instance
SetField errorId FailureStatus Text
- instance
SetField getAll All Bool
- instance
SetField getAny Any Bool
- instance
SetField getAnyView AnyView Any
- instance
SetField getAnyViewInterfaceTypeRep AnyView InterfaceTypeRep
- instance
SetField hd (NonEmpty a) a
- instance
SetField map (Set k) (Map k ())
- instance
SetField message FailureStatus Text
- instance
SetField message ArithmeticError Text
- instance
SetField message AssertionFailed Text
- instance
SetField message GeneralError Text
- instance
SetField message PreconditionFailed Text
- instance
SetField meta FailureStatus (TextMap Text)
- instance
SetField runState (State s a) (s -> (a, s))
- instance
SetField srcLocEndCol SrcLoc Int
- instance
SetField srcLocEndLine SrcLoc Int
- instance
SetField srcLocFile SrcLoc Text
- instance
SetField srcLocModule SrcLoc Text
- instance
SetField srcLocPackage SrcLoc Text
- instance
SetField srcLocStartCol SrcLoc Int
- instance
SetField srcLocStartLine SrcLoc Int
- instance
SetField tl (NonEmpty a) [a]