lazify-0.1.0.1: A simple utility for lazy record matching
Safe HaskellNone
LanguageHaskell2010

Data.Lazify.Generic.Internal

Description

Record types in Haskell can be made lazy through lazy pattern matching. This module offers functions for making them lazy generically.

Synopsis

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.

Methods

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

Instances details
(Generic a, LazifiableG a (Rep a)) => GenericLazifiable a Source #

The generic instance.

Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: a -> a Source #

Typeable a => GenericLazifiable (TypeRep a) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Coercible a b => GenericLazifiable (Coercion a b) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: Coercion a b -> Coercion a b Source #

a ~ b => GenericLazifiable (a :~: b) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: (a :~: b) -> a :~: b Source #

a ~~ b => GenericLazifiable (a :~~: b) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: (a :~~: b) -> a :~~: b Source #

GenericLazifiable (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) Source #

GenericLazifiable (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) Source #

GenericLazifiable (a, b, c, d, e, f, g, h, i, j) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyGeneric :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) Source #

class LazifiableG a f where Source #

A Generic representation that can be lazified.

Methods

lazifyG :: f p -> f p Source #

Lazify a Generic representation.

Instances

Instances details
LazifiableG (a :: k1) (U1 :: k2 -> Type) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). U1 p -> U1 p Source #

(TypeError ((('Text "Can't lazify " :<>: 'ShowType a) :<>: 'Text ":") :$$: 'Text "It is a sum type.") :: Constraint) => LazifiableG (a :: k1) (f :+: g :: k2 -> Type) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). (f :+: g) p -> (f :+: g) p Source #

(LazifiableG a f, LazifiableG a g) => LazifiableG (a :: k1) (f :*: g :: k2 -> Type) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). (f :*: g) p -> (f :*: g) p Source #

LazifiableG (a :: k1) (K1 i c :: k2 -> Type) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). K1 i c p -> K1 i c p Source #

GenericLazifiable c => LazifiableG (a :: k1) (D1 ('MetaData x y z 'True) (C1 _p (S1 _q (Rec0 c))) :: k2 -> Type) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). D1 ('MetaData x y z 'True) (C1 _p (S1 _q (Rec0 c))) p -> D1 ('MetaData x y z 'True) (C1 _p (S1 _q (Rec0 c))) p 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 # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

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 # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

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 # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

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 # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). C1 c f p -> C1 c f p Source #

LazifiableG a f => LazifiableG (a :: k1) (D1 ('MetaData x y z 'False) f :: k2 -> Type) Source # 
Instance details

Defined in Data.Lazify.Generic.Internal

Methods

lazifyG :: forall (p :: k). D1 ('MetaData x y z 'False) f p -> D1 ('MetaData x y z 'False) f p 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.