generic-data-1.1.0.2: Deriving instances with GHC.Generics and related utilities

Safe Haskell | None
Language | Haskell2010

Generic.Data.Types

Description

Utilities to derive and transform generic types.

Synopsis

- newtype Data (r :: Type -> Type) p = Data {
  - unData :: r p
  }
- toData :: Generic a => a -> Data (Rep a) p
- fromData :: Generic a => Data (Rep a) p -> a

# Documentation

newtype Data (r :: Type -> Type) p Source #

Synthetic data type.

A wrapper to view a generic `Rep` as the datatype it's supposed to represent, without needing a declaration.

Constructors

Data |

Fields

- unData :: r p

#### Instances

Instances details

Generic1 (Data r :: Type -> Type) Source # |

Instance details

Defined in Generic.Data.Internal.Data

Associated Types

type Rep1 (Data r :: Type -> Type) |
Instance details Defined in Generic.Data.Internal.Data type Rep1 (Data r :: Type -> Type) = r

Methods

from1 :: Data r a -> Rep1 (Data r) a Source #

to1 :: Rep1 (Data r) a -> Data r a Source #

Eq1 r => Eq1 (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods liftEq :: (a -> b -> Bool) -> Data r a -> Data r b -> Bool Source #
Ord1 r => Ord1 (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods liftCompare :: (a -> b -> Ordering) -> Data r a -> Data r b -> Ordering Source #
GShow1 r => Show1 (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Data r a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Data r a] -> ShowS Source #
Contravariant r => Contravariant (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods contramap :: (a' -> a) -> Data r a -> Data r a' Source # (>$) :: b -> Data r b -> Data r a Source #
Alternative r => Alternative (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods empty :: Data r a Source # (<|>) :: Data r a -> Data r a -> Data r a Source # some :: Data r a -> Data r [a] Source # many :: Data r a -> Data r [a] Source #
Applicative r => Applicative (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods pure :: a -> Data r a Source # (<*>) :: Data r (a -> b) -> Data r a -> Data r b Source # liftA2 :: (a -> b -> c) -> Data r a -> Data r b -> Data r c Source # (*>) :: Data r a -> Data r b -> Data r b Source # (<*) :: Data r a -> Data r b -> Data r a Source #
Functor r => Functor (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods fmap :: (a -> b) -> Data r a -> Data r b Source # (<$) :: a -> Data r b -> Data r a Source #
Monad r => Monad (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods (>>=) :: Data r a -> (a -> Data r b) -> Data r b Source # (>>) :: Data r a -> Data r b -> Data r b Source # return :: a -> Data r a Source #
MonadPlus r => MonadPlus (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods mzero :: Data r a Source # mplus :: Data r a -> Data r a -> Data r a Source #
Foldable r => Foldable (Data r) Source # |

Instance details

Defined in Generic.Data.Internal.Data

Methods

fold :: Monoid m => Data r m -> m Source #

foldMap :: Monoid m => (a -> m) -> Data r a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Data r a -> m Source #

foldr :: (a -> b -> b) -> b -> Data r a -> b Source #

foldr' :: (a -> b -> b) -> b -> Data r a -> b Source #

foldl :: (b -> a -> b) -> b -> Data r a -> b Source #

foldl' :: (b -> a -> b) -> b -> Data r a -> b Source #

foldr1 :: (a -> a -> a) -> Data r a -> a Source #

foldl1 :: (a -> a -> a) -> Data r a -> a Source #

toList :: Data r a -> [a] Source #

null :: Data r a -> Bool Source #

length :: Data r a -> Int Source #

elem :: Eq a => a -> Data r a -> Bool Source #

maximum :: Ord a => Data r a -> a Source #

minimum :: Ord a => Data r a -> a Source #

sum :: Num a => Data r a -> a Source #

product :: Num a => Data r a -> a Source #

Traversable r => Traversable (Data r) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods traverse :: Applicative f => (a -> f b) -> Data r a -> f (Data r b) Source # sequenceA :: Applicative f => Data r (f a) -> f (Data r a) Source # mapM :: Monad m => (a -> m b) -> Data r a -> m (Data r b) Source # sequence :: Monad m => Data r (m a) -> m (Data r a) Source #
Monoid (r p) => Monoid (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods mempty :: Data r p Source # mappend :: Data r p -> Data r p -> Data r p Source # mconcat :: [Data r p] -> Data r p Source #
Semigroup (r p) => Semigroup (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods (<>) :: Data r p -> Data r p -> Data r p Source # sconcat :: NonEmpty (Data r p) -> Data r p Source # stimes :: Integral b => b -> Data r p -> Data r p Source #
GBounded r => Bounded (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods minBound :: Data r p Source # maxBound :: Data r p Source #
GEnum StandardEnum r => Enum (Data r p) Source # |

Instance details

Defined in Generic.Data.Internal.Data

Methods

succ :: Data r p -> Data r p Source #

pred :: Data r p -> Data r p Source #

toEnum :: Int -> Data r p Source #

fromEnum :: Data r p -> Int Source #

enumFrom :: Data r p -> [Data r p] Source #

enumFromThen :: Data r p -> Data r p -> [Data r p] Source #

enumFromTo :: Data r p -> Data r p -> [Data r p] Source #

enumFromThenTo :: Data r p -> Data r p -> Data r p -> [Data r p] Source #

(Functor r, Contravariant r) => Generic (Data r p) Source # |

Instance details

Defined in Generic.Data.Internal.Data

Associated Types

type Rep (Data r p) |
Instance details Defined in Generic.Data.Internal.Data type Rep (Data r p) = r

Methods

from :: Data r p -> Rep (Data r p) x Source #

to :: Rep (Data r p) x -> Data r p Source #

(GShow1 r, Show p) => Show (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods showsPrec :: Int -> Data r p -> ShowS Source # show :: Data r p -> String Source # showList :: [Data r p] -> ShowS Source #
Eq (r p) => Eq (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods (==) :: Data r p -> Data r p -> Bool Source # (/=) :: Data r p -> Data r p -> Bool Source #
Ord (r p) => Ord (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data Methods compare :: Data r p -> Data r p -> Ordering Source # (<) :: Data r p -> Data r p -> Bool Source # (<=) :: Data r p -> Data r p -> Bool Source # (>) :: Data r p -> Data r p -> Bool Source # (>=) :: Data r p -> Data r p -> Bool Source # max :: Data r p -> Data r p -> Data r p Source # min :: Data r p -> Data r p -> Data r p Source #
type Rep1 (Data r :: Type -> Type) Source # |
Instance details Defined in Generic.Data.Internal.Data type Rep1 (Data r :: Type -> Type) = r
type Rep (Data r p) Source # |
Instance details Defined in Generic.Data.Internal.Data type Rep (Data r p) = r

toData :: Generic a => a -> Data (Rep a) p Source #

Conversion between a generic type and the synthetic type made using its representation. Inverse of `fromData`.

fromData :: Generic a => Data (Rep a) p -> a Source #

Inverse of `toData`.