ruin-0.1.0.0: Pliable records

Safe HaskellNone
LanguageHaskell2010

Data.Ruin.Deep

Contents

Synopsis

Sequences of labels

type Labels fs = Labels_ '[] -> Labels_ fs Source #

This type is an instance of a type-level difference list, so that sequences of labels can be written as #x . #y . #z :: Labels '["x","y","z"], for example.

consLabels :: forall s ss. Labels_ ss -> Labels_ (s ': ss) Source #

mkLabels :: forall fs. Labels fs Source #

nilLabels :: Labels_ '[] Source #

Deep projection

type DeepFieldType ss t = DeepFieldType_ ss t Source #

This constraint is an implementation detail of extricate. It's just an iteration of FieldType.

type DeepHas = DeepHas_ Source #

This constraint is an implementation detail of extricate. It's just an iteration of Has.

extricate :: forall ss t. DeepHas ss t => Labels ss -> t -> Eval (DeepFieldType ss t) Source #

extricate project a field out of nested records by iterating extricate1.

The first argument is a function type so that the syntax can use . to specify a sequence of labels.

  extricate id = return

  extricate (#s . ss) = extricate1 #s Control.Monad.>=> extricate ss