Safe Haskell | None |
---|---|

Language | Haskell2010 |

This modules makes it possible to declare that a type `Has`

*only* its `Fields`

. This can lead to better type error messages.

These classses should be instantiated as follows. Note that
`makeRecords`

does this automatically.

data XY x y = MkXY {x::x,y::y} deriving Generic instance`ClosedHas`

s XY =>`Has`

s XY where {-# INLINE`extricate1`

#-}`extricate1`

=`closedExtricate1`

instance`HasCase`

"x" XY -- Just like usual`Has`

instances. instance`HasCase`

"y" XY instance`Build`

XY where {-# INLINE`build`

#-}`build`

=`genericBuild`

- type ClosedHas s t = HasIf (Elem s (FieldNames t)) s t
- class HasCase s t where
- type FieldTypeCase s t :: *

- closedExtricate1 :: forall s t. ClosedHas s t => Label s -> t -> Eval (FieldType s t)

# Documentation

type ClosedHas s t = HasIf (Elem s (FieldNames t)) s t Source #

class HasCase s t where Source #

Exactly the same as `Has`

, but `ClosedHas`

delegates to this copy,
so that `Has`

can delegate parametrically to `ClosedHas`

!

type FieldTypeCase s t :: * Source #

extricate1Case :: Label s -> t -> Eval (FieldType s t) Source #

extricate1Case :: (Generic t, GBox (IsABox (Rep t)) t, GenericHas (Rep t) s (FieldType s t)) => Label s -> t -> Eval (FieldType s t) Source #

KnownSymbol s => HasCase s (R fd) Source # | |