lazify-0.1.0.0: 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 LazifiableG f where Source #

A Generic representation that can be lazified.

Minimal complete definition

lazifyG

Methods

lazifyG :: f a -> f a Source #

Lazify a Generic representation.

Instances

LazifiableG k (U1 k) Source # 

Methods

lazifyG :: f a -> f a Source #

(LazifiableG k f, LazifiableG k g) => LazifiableG k ((:*:) k f g) Source # 

Methods

lazifyG :: f a -> f a Source #

LazifiableG k (K1 k i c) Source # 

Methods

lazifyG :: f a -> f a Source #

LazifiableG k f => LazifiableG k (S1 k c f) Source # 

Methods

lazifyG :: f a -> f a Source #

LazifiableG k f => LazifiableG k (C1 k c f) Source # 

Methods

lazifyG :: f a -> f a Source #

LazifiableG k f => LazifiableG k (D1 k (MetaData x y z False) f) Source # 

Methods

lazifyG :: f a -> f a Source #

IsNewtypeG k f => LazifiableG k (D1 k (MetaData x y z True) f) Source # 

Methods

lazifyG :: f a -> f a Source #

class IsNewtypeG f where Source #

A Generic representation that should be lazified newtype-style. That is, its contents should be lazified.

Minimal complete definition

lazifyNewtypeG

Methods

lazifyNewtypeG :: f a -> f a Source #

Dig into a newtype and lazify its payload generically.

Instances

(Generic a, LazifiableG * (Rep a)) => IsNewtypeG k (K1 k i a) Source # 

Methods

lazifyNewtypeG :: f a -> f a Source #

IsNewtypeG k f => IsNewtypeG k (M1 k i c f) Source # 

Methods

lazifyNewtypeG :: f a -> f a Source #

lazifyGeneric :: (Generic a, LazifiableG (Rep a)) => 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.

($~) :: forall rep a (b :: TYPE rep). (Generic a, LazifiableG (Rep a)) => (a -> b) -> a -> b Source #

Apply a function to a lazified value.