Safe Haskell | None |
---|---|
Language | Haskell2010 |
Record types in Haskell can be made lazy through lazy pattern matching. This module offers functions for making them lazy generically.
Synopsis
- class GenericLazifiable a where
- lazifyGeneric :: a -> a
- class LazifiableG a f where
- lazifyG :: f p -> f p
- ($~) :: forall rep a (b :: TYPE rep). GenericLazifiable a => (a -> b) -> a -> b
Documentation
class GenericLazifiable a where Source #
This class is intended to be used primarily with the
generic instance given in this module. However, users are free
to write {-# OVERLAPPING #-}
instances whenever necessary.
lazifyGeneric :: a -> a Source #
Lazify a record using its generic representation.
Note that newtypes are treated specially: a newtype is lazified by lazifying its underlying type.
Instances
class LazifiableG a f where Source #
A Generic
representation that can be lazified.
Instances
LazifiableG (a :: k1) (U1 :: k2 -> Type) Source # | |
(TypeError ((('Text "Can't lazify " :<>: 'ShowType a) :<>: 'Text ":") :$$: 'Text "It is a sum type.") :: Constraint) => LazifiableG (a :: k1) (f :+: g :: k2 -> Type) Source # | |
(LazifiableG a f, LazifiableG a g) => LazifiableG (a :: k1) (f :*: g :: k2 -> Type) Source # | |
LazifiableG (a :: k1) (K1 i c :: k2 -> Type) Source # | |
GenericLazifiable c => LazifiableG (a :: k1) (D1 ('MetaData x y z 'True) (C1 _p (S1 _q (Rec0 c))) :: k2 -> Type) Source # | |
(TypeError ((('Text "Can't lazify " :<>: 'ShowType a) :<>: 'Text ":") :$$: 'Text "It has a strict (unpacked) field.") :: Constraint) => LazifiableG (a :: k1) (S1 ('MetaSel _p _q _r 'DecidedUnpack) f :: k2 -> Type) Source # | |
Defined in Data.Lazify.Generic.Internal lazifyG :: forall (p :: k). S1 ('MetaSel _p _q _r 'DecidedUnpack) f p -> S1 ('MetaSel _p _q _r 'DecidedUnpack) f p Source # | |
(TypeError ((('Text "Can't lazify " :<>: 'ShowType a) :<>: 'Text ":") :$$: 'Text "It has a strict field.") :: Constraint) => LazifiableG (a :: k1) (S1 ('MetaSel _p _q _r 'DecidedStrict) f :: k2 -> Type) Source # | |
Defined in Data.Lazify.Generic.Internal lazifyG :: forall (p :: k). S1 ('MetaSel _p _q _r 'DecidedStrict) f p -> S1 ('MetaSel _p _q _r 'DecidedStrict) f p Source # | |
LazifiableG a f => LazifiableG (a :: k1) (S1 ('MetaSel _p _q _r 'DecidedLazy) f :: k2 -> Type) Source # | |
Defined in Data.Lazify.Generic.Internal lazifyG :: forall (p :: k). S1 ('MetaSel _p _q _r 'DecidedLazy) f p -> S1 ('MetaSel _p _q _r 'DecidedLazy) f p Source # | |
LazifiableG a f => LazifiableG (a :: k1) (C1 c f :: k2 -> Type) Source # | |
LazifiableG a f => LazifiableG (a :: k1) (D1 ('MetaData x y z 'False) f :: k2 -> Type) Source # | |
($~) :: forall rep a (b :: TYPE rep). GenericLazifiable a => (a -> b) -> a -> b Source #
Apply a function to a lazified value.
Note to users of TypeApplications
: For GHC >= 9.0.1, the representation
is marked as inferred. Before that, doing so is impossible and the
representation must be passed as the first type argument. I'm sorry.