15 | ||| Specification for a record, consisting of a list of key value pairs, where the value is the specification for that field.
20 | ||| A field (label value pair) in the record, with the given label and
21 | ||| type. The label is erased at the value level, but included to
22 | ||| make it easy to see which field is used in the code.
27 | ||| A field definition for a given label.
32 | ||| Get the specification for a single field.
37 | ||| The actual type of a field in the record.
42 | ||| A strongly specified record. The type contains the specification,
43 | ||| and a function mapping that specification for each field to a
44 | ||| concrete type.
55 | ||| Simple record with types as specification
60 | ||| Constraint that holds for all values in a list.
66 | ||| proof that the spec has some label with the given spec
72 | %builtin Natural HasField
82 | ||| Proof that a spec is a subset of another spec.
87 | ||| A label of a spec. Contains a hidden (auto) proof that the label
88 | ||| is actually in the RecordSpec, and a hidden reference to the field Spec.
97 | ||| Extract the string of the label
98 | export
102 | ||| Extract the spec from the label
103 | export
111 | ||| proof that an optional field with the given spec exists. The spec
112 | ||| must be either present with the right type, or be absent. This is
113 | ||| written in terms of HasField, so it is isomorphic to Maybe
114 | ||| Natural, which has an efficient runtime representation.
128 | export
134 | export
143 | MkNubFields : {spec:RecordSpec k} -> {fields: RecordSpec k} -> NubFields spec fields (remFields spec fields)
145 | ||| Proof that a record contains some mandatory fields, some optional
146 | ||| fields, and some remaining fields.
161 | ||| Create an integer index of the field from the HasField proof.
162 | export
166 | %builtin NaturalToInteger natToInteger
168 | ||| Get a field value by label
178 | ||| Get a field specification from the RecordSpec by label
184 | k
188 | ||| Operator version of get with arguments flipped.
189 | export
197 | ||| Get an optional field from a spec, as Maybe value
199 | getMaybe : {0 f:FieldToType k} -> (0 s:String) -> HasOptionalField s t r => Record r f -> Maybe (f (s :->: t))
203 | ||| Get an optional field, return the given default if it is not found.
205 | getOpt : {0 f:FieldToType k} -> (0 s:String) -> HasOptionalField s t r => Lazy (f (s :->: t)) -> Record r f -> f (s :->: t)
208 | ||| Set a field in a record.
209 | export
220 | ||| Map a function over all fields of a record.
231 | ||| Run all the effects for each field.
242 | ||| Apply an effectful function over all fields of the record.
258 | ||| convenient specialization of sequenceRecord, to bind applicative
259 | ||| values. Useful as replacement of applicative do in haskell.
267 | ||| Create a record by applying a function over each field in the RecordSpec.
276 | ||| Create a record by applying an effectful function over each field in the RecordSpec.
287 | ||| Zip two records for each field in the record.
302 | ||| Higher kinded heterogenous list
308 | ||| map a Hkd List
309 | export
324 | ||| Zip a (heterogenous) list of records, by zipping each row over a
325 | ||| function. The function takes a list of all the values in that row
326 | ||| for each of the records.
327 | export
340 | ||| Maps each field to a value and combine them.
341 | export
347 | m
351 | ||| Successively combine the fields using the provided function,
352 | ||| starting with the element that is in the final position i.e. the
353 | ||| right-most position.
354 | export
360 | acc
364 | ||| Successively combine the fields using the provided function,
365 | ||| starting with the element that is in the first position i.e. the
366 | ||| left-most position.
367 | export
373 | acc
377 | ||| create a record with all the labels of the spec.
378 | export
383 | ||| Type of the interface implementation for a given field.
388 | ||| Create a record with the interface implementations for each field of the spec.
389 | export
397 | ||| Create a record with the specs for each field from the record spec.
398 | export
403 | ||| Concatenate two records
404 | export
414 | ||| A subset of a RecordSpec, given a list of labels.
423 | ||| Create a subset of a record, given a list of labels.
424 | export