Portability | unknown |
---|---|

Stability | experimental |

Maintainer | nonowarn@gmail.com |

Entiry based records.

- class Knows lab (TypeOf lab) s => Has lab s
- type Field a = a ::: TyNil
- (&) :: Append a b => a -> b -> a :&: b
- type family a :&: b
- field :: a -> Field a
- (^=) :: Knows lab (TypeOf lab) s => lab -> TypeOf lab -> s -> s
- (^.) :: Knows lab (TypeOf lab) s => lab -> s -> TypeOf lab
- (^:) :: Knows lab (TypeOf lab) s => lab -> (TypeOf lab -> TypeOf lab) -> s -> s
- class Contains (Labelled lab e) s => Knows lab e s | lab s -> e where
- updl :: Knows lab b a => lab -> (b -> b) -> a -> a
- data Labelled lab a
- type :> lab a = Field (Labelled lab a)
- (.>) :: lab -> a -> lab :> a
- type family TypeOf a
- type family FieldOf a
- fieldOf :: TypeOf a -> FieldOf a
- data a ::: b
- data TyNil
- class Contains e s

# Has class

class Knows lab (TypeOf lab) s => Has lab s Source

Same as `Knows lab (TypeOf lab) s`

, Useful on writing type
signitures.

Holds `e == (lab .^ (lab ^= e $ s))`

where `lab :: lab; e :: TypeOf lab; s :: s`

# Rows in records

type Field a = a ::: TyNilSource

`Field a`

is a type list which contains only one element of
`a`

. And every field in the records should be this type.

(&) :: Append a b => a -> b -> a :&: bSource

Concatenates between `Field`

s or records. Records are
concatenated rows. For example, Following expressions are
valid.

-- Concatenation of rows (i.e. record) field "string" & field True

-- Concatenation of records (field 'c' & field ()) & (field False & field "string")

-- ... And concatenations between a field and a record field () & (field False & field "string") (field 'c' & field ()) & field False

# Update and Lookup values from records

(^:) :: Knows lab (TypeOf lab) s => lab -> (TypeOf lab -> TypeOf lab) -> s -> sSource

Strict version of `updl`

class Contains (Labelled lab e) s => Knows lab e s | lab s -> e whereSource

Injects and Projects a labelled values into records.

# Labelled values

Represents labelled value.

## Defining labels

# Make parsing error messages easier

Cons a type onto type-list.

Contains e r => Contains e (::: h r) | |

Contains e (::: e r) | |

(Bounded a, Bounded b) => Bounded (::: a b) | |

(Eq a, Eq b) => Eq (::: a b) | |

(Ord a, Ord b) => Ord (::: a b) | |

(Read a, Read b) => Read (::: a b) | |

(Show a, Show b) => Show (::: a b) | |

(Arbitrary a, Arbitrary b) => Arbitrary (::: a b) | |

(CoArbitrary a, CoArbitrary b) => CoArbitrary (::: a b) | |

(Monoid a, Monoid b) => Monoid (::: a b) | |

Append y b => Append (::: x y) b |

The empty type-list.