| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Barbies.TH
Synopsis
- class FieldNamesB b where
- bfieldNames :: IsString a => b (Const a)
- bnestedFieldNames :: IsString a => b (Const (NonEmpty a))
- data LensB b a = LensB {}
- getLensB :: Functor f => LensB b a -> (h a -> f (h a)) -> b h -> f (b h)
- class AccessorsB b where
- baccessors :: b (LensB b)
- declareBareB :: DecsQ -> DecsQ
- declareBareBWith :: DeclareBareBConfig -> DecsQ -> DecsQ
- declareBareBWithOtherBarbies :: [Name] -> DecsQ -> DecsQ
- passthroughBareB :: DecsQ -> DecsQ
Documentation
class FieldNamesB b where Source #
barbies doesn't care about field names, but they are useful in many use cases
A pair of a getter and a setter Not van Laarhoven to avoid dictionary passing
getLensB :: Functor f => LensB b a -> (h a -> f (h a)) -> b h -> f (b h) Source #
Obtain a van-laarhoven lens (compatible with the lens library) from LensB
class AccessorsB b where Source #
The class of higher-kinded datatypes where lenses can be defined
declareBareB :: DecsQ -> DecsQ Source #
Transform a regular Haskell record declaration into HKD form.
BareB, FieldNamesB, FunctorB, DistributiveB,
TraversableB, ApplicativeB and ConstraintsB instances are
derived.
For example,
declareBareB [d|data User = User { uid :: Int, name :: String}|]becomes
data User t f = User { uid :: Wear t f Int, name :: Wear t f String }declareBareBWith :: DeclareBareBConfig -> DecsQ -> DecsQ Source #
Generate a higher-kinded data declaration using a custom config
declareBareBWithOtherBarbies :: [Name] -> DecsQ -> DecsQ Source #
Like declareBareB except that one can specify the Names of other
barbies. Members with these types won't be wrapped with Wear.
passthroughBareB :: DecsQ -> DecsQ Source #
Defines a synonym for the bare type with the same name. The strippable definition is suffixed by B, and the covered type is suffixed by H.