{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

-- | Generic representations as data types.
--
-- === Warning
--
-- This is an internal module: it is not subject to any versioning policy,
-- breaking changes can happen at any time.
--
-- If something here seems useful, please report it or create a pull request to
-- export it from an external module.

module Generic.Data.Internal.Data where

import Control.Applicative
import Control.Monad
import Data.Functor.Classes
import Data.Functor.Contravariant (Contravariant, phantom)
import Data.Semigroup
import GHC.Generics

import Generic.Data.Internal.Enum
import Generic.Data.Internal.Show

-- | Synthetic data type.
--
-- A wrapper to view a generic 'Rep' as the datatype it's supposed to
-- represent, without needing a declaration.
newtype Data r p = Data { Data r p -> r p
unData :: r p }
  deriving ( a -> Data r b -> Data r a
(a -> b) -> Data r a -> Data r b
(forall a b. (a -> b) -> Data r a -> Data r b)
-> (forall a b. a -> Data r b -> Data r a) -> Functor (Data r)
forall a b. a -> Data r b -> Data r a
forall a b. (a -> b) -> Data r a -> Data r b
forall (r :: * -> *) a b. Functor r => a -> Data r b -> Data r a
forall (r :: * -> *) a b.
Functor r =>
(a -> b) -> Data r a -> Data r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Data r b -> Data r a
$c<$ :: forall (r :: * -> *) a b. Functor r => a -> Data r b -> Data r a
fmap :: (a -> b) -> Data r a -> Data r b
$cfmap :: forall (r :: * -> *) a b.
Functor r =>
(a -> b) -> Data r a -> Data r b
Functor, a -> Data r a -> Bool
Data r m -> m
Data r a -> [a]
Data r a -> Bool
Data r a -> Int
Data r a -> a
Data r a -> a
Data r a -> a
Data r a -> a
(a -> m) -> Data r a -> m
(a -> m) -> Data r a -> m
(a -> b -> b) -> b -> Data r a -> b
(a -> b -> b) -> b -> Data r a -> b
(b -> a -> b) -> b -> Data r a -> b
(b -> a -> b) -> b -> Data r a -> b
(a -> a -> a) -> Data r a -> a
(a -> a -> a) -> Data r a -> a
(forall m. Monoid m => Data r m -> m)
-> (forall m a. Monoid m => (a -> m) -> Data r a -> m)
-> (forall m a. Monoid m => (a -> m) -> Data r a -> m)
-> (forall a b. (a -> b -> b) -> b -> Data r a -> b)
-> (forall a b. (a -> b -> b) -> b -> Data r a -> b)
-> (forall b a. (b -> a -> b) -> b -> Data r a -> b)
-> (forall b a. (b -> a -> b) -> b -> Data r a -> b)
-> (forall a. (a -> a -> a) -> Data r a -> a)
-> (forall a. (a -> a -> a) -> Data r a -> a)
-> (forall a. Data r a -> [a])
-> (forall a. Data r a -> Bool)
-> (forall a. Data r a -> Int)
-> (forall a. Eq a => a -> Data r a -> Bool)
-> (forall a. Ord a => Data r a -> a)
-> (forall a. Ord a => Data r a -> a)
-> (forall a. Num a => Data r a -> a)
-> (forall a. Num a => Data r a -> a)
-> Foldable (Data r)
forall a. Eq a => a -> Data r a -> Bool
forall a. Num a => Data r a -> a
forall a. Ord a => Data r a -> a
forall m. Monoid m => Data r m -> m
forall a. Data r a -> Bool
forall a. Data r a -> Int
forall a. Data r a -> [a]
forall a. (a -> a -> a) -> Data r a -> a
forall m a. Monoid m => (a -> m) -> Data r a -> m
forall b a. (b -> a -> b) -> b -> Data r a -> b
forall a b. (a -> b -> b) -> b -> Data r a -> b
forall (r :: * -> *) a. (Foldable r, Eq a) => a -> Data r a -> Bool
forall (r :: * -> *) a. (Foldable r, Num a) => Data r a -> a
forall (r :: * -> *) a. (Foldable r, Ord a) => Data r a -> a
forall (r :: * -> *) m. (Foldable r, Monoid m) => Data r m -> m
forall (r :: * -> *) a. Foldable r => Data r a -> Bool
forall (r :: * -> *) a. Foldable r => Data r a -> Int
forall (r :: * -> *) a. Foldable r => Data r a -> [a]
forall (r :: * -> *) a.
Foldable r =>
(a -> a -> a) -> Data r a -> a
forall (r :: * -> *) m a.
(Foldable r, Monoid m) =>
(a -> m) -> Data r a -> m
forall (r :: * -> *) b a.
Foldable r =>
(b -> a -> b) -> b -> Data r a -> b
forall (r :: * -> *) a b.
Foldable r =>
(a -> b -> b) -> b -> Data r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Data r a -> a
$cproduct :: forall (r :: * -> *) a. (Foldable r, Num a) => Data r a -> a
sum :: Data r a -> a
$csum :: forall (r :: * -> *) a. (Foldable r, Num a) => Data r a -> a
minimum :: Data r a -> a
$cminimum :: forall (r :: * -> *) a. (Foldable r, Ord a) => Data r a -> a
maximum :: Data r a -> a
$cmaximum :: forall (r :: * -> *) a. (Foldable r, Ord a) => Data r a -> a
elem :: a -> Data r a -> Bool
$celem :: forall (r :: * -> *) a. (Foldable r, Eq a) => a -> Data r a -> Bool
length :: Data r a -> Int
$clength :: forall (r :: * -> *) a. Foldable r => Data r a -> Int
null :: Data r a -> Bool
$cnull :: forall (r :: * -> *) a. Foldable r => Data r a -> Bool
toList :: Data r a -> [a]
$ctoList :: forall (r :: * -> *) a. Foldable r => Data r a -> [a]
foldl1 :: (a -> a -> a) -> Data r a -> a
$cfoldl1 :: forall (r :: * -> *) a.
Foldable r =>
(a -> a -> a) -> Data r a -> a
foldr1 :: (a -> a -> a) -> Data r a -> a
$cfoldr1 :: forall (r :: * -> *) a.
Foldable r =>
(a -> a -> a) -> Data r a -> a
foldl' :: (b -> a -> b) -> b -> Data r a -> b
$cfoldl' :: forall (r :: * -> *) b a.
Foldable r =>
(b -> a -> b) -> b -> Data r a -> b
foldl :: (b -> a -> b) -> b -> Data r a -> b
$cfoldl :: forall (r :: * -> *) b a.
Foldable r =>
(b -> a -> b) -> b -> Data r a -> b
foldr' :: (a -> b -> b) -> b -> Data r a -> b
$cfoldr' :: forall (r :: * -> *) a b.
Foldable r =>
(a -> b -> b) -> b -> Data r a -> b
foldr :: (a -> b -> b) -> b -> Data r a -> b
$cfoldr :: forall (r :: * -> *) a b.
Foldable r =>
(a -> b -> b) -> b -> Data r a -> b
foldMap' :: (a -> m) -> Data r a -> m
$cfoldMap' :: forall (r :: * -> *) m a.
(Foldable r, Monoid m) =>
(a -> m) -> Data r a -> m
foldMap :: (a -> m) -> Data r a -> m
$cfoldMap :: forall (r :: * -> *) m a.
(Foldable r, Monoid m) =>
(a -> m) -> Data r a -> m
fold :: Data r m -> m
$cfold :: forall (r :: * -> *) m. (Foldable r, Monoid m) => Data r m -> m
Foldable, Functor (Data r)
Foldable (Data r)
Functor (Data r)
-> Foldable (Data r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Data r a -> f (Data r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Data r (f a) -> f (Data r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Data r a -> m (Data r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Data r (m a) -> m (Data r a))
-> Traversable (Data r)
(a -> f b) -> Data r a -> f (Data r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (r :: * -> *). Traversable r => Functor (Data r)
forall (r :: * -> *). Traversable r => Foldable (Data r)
forall (r :: * -> *) (m :: * -> *) a.
(Traversable r, Monad m) =>
Data r (m a) -> m (Data r a)
forall (r :: * -> *) (f :: * -> *) a.
(Traversable r, Applicative f) =>
Data r (f a) -> f (Data r a)
forall (r :: * -> *) (m :: * -> *) a b.
(Traversable r, Monad m) =>
(a -> m b) -> Data r a -> m (Data r b)
forall (r :: * -> *) (f :: * -> *) a b.
(Traversable r, Applicative f) =>
(a -> f b) -> Data r a -> f (Data r b)
forall (m :: * -> *) a. Monad m => Data r (m a) -> m (Data r a)
forall (f :: * -> *) a.
Applicative f =>
Data r (f a) -> f (Data r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Data r a -> m (Data r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Data r a -> f (Data r b)
sequence :: Data r (m a) -> m (Data r a)
$csequence :: forall (r :: * -> *) (m :: * -> *) a.
(Traversable r, Monad m) =>
Data r (m a) -> m (Data r a)
mapM :: (a -> m b) -> Data r a -> m (Data r b)
$cmapM :: forall (r :: * -> *) (m :: * -> *) a b.
(Traversable r, Monad m) =>
(a -> m b) -> Data r a -> m (Data r b)
sequenceA :: Data r (f a) -> f (Data r a)
$csequenceA :: forall (r :: * -> *) (f :: * -> *) a.
(Traversable r, Applicative f) =>
Data r (f a) -> f (Data r a)
traverse :: (a -> f b) -> Data r a -> f (Data r b)
$ctraverse :: forall (r :: * -> *) (f :: * -> *) a b.
(Traversable r, Applicative f) =>
(a -> f b) -> Data r a -> f (Data r b)
$cp2Traversable :: forall (r :: * -> *). Traversable r => Foldable (Data r)
$cp1Traversable :: forall (r :: * -> *). Traversable r => Functor (Data r)
Traversable, Functor (Data r)
a -> Data r a
Functor (Data r)
-> (forall a. a -> Data r a)
-> (forall a b. Data r (a -> b) -> Data r a -> Data r b)
-> (forall a b c.
    (a -> b -> c) -> Data r a -> Data r b -> Data r c)
-> (forall a b. Data r a -> Data r b -> Data r b)
-> (forall a b. Data r a -> Data r b -> Data r a)
-> Applicative (Data r)
Data r a -> Data r b -> Data r b
Data r a -> Data r b -> Data r a
Data r (a -> b) -> Data r a -> Data r b
(a -> b -> c) -> Data r a -> Data r b -> Data r c
forall a. a -> Data r a
forall a b. Data r a -> Data r b -> Data r a
forall a b. Data r a -> Data r b -> Data r b
forall a b. Data r (a -> b) -> Data r a -> Data r b
forall a b c. (a -> b -> c) -> Data r a -> Data r b -> Data r c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall (r :: * -> *). Applicative r => Functor (Data r)
forall (r :: * -> *) a. Applicative r => a -> Data r a
forall (r :: * -> *) a b.
Applicative r =>
Data r a -> Data r b -> Data r a
forall (r :: * -> *) a b.
Applicative r =>
Data r a -> Data r b -> Data r b
forall (r :: * -> *) a b.
Applicative r =>
Data r (a -> b) -> Data r a -> Data r b
forall (r :: * -> *) a b c.
Applicative r =>
(a -> b -> c) -> Data r a -> Data r b -> Data r c
<* :: Data r a -> Data r b -> Data r a
$c<* :: forall (r :: * -> *) a b.
Applicative r =>
Data r a -> Data r b -> Data r a
*> :: Data r a -> Data r b -> Data r b
$c*> :: forall (r :: * -> *) a b.
Applicative r =>
Data r a -> Data r b -> Data r b
liftA2 :: (a -> b -> c) -> Data r a -> Data r b -> Data r c
$cliftA2 :: forall (r :: * -> *) a b c.
Applicative r =>
(a -> b -> c) -> Data r a -> Data r b -> Data r c
<*> :: Data r (a -> b) -> Data r a -> Data r b
$c<*> :: forall (r :: * -> *) a b.
Applicative r =>
Data r (a -> b) -> Data r a -> Data r b
pure :: a -> Data r a
$cpure :: forall (r :: * -> *) a. Applicative r => a -> Data r a
$cp1Applicative :: forall (r :: * -> *). Applicative r => Functor (Data r)
Applicative, Applicative (Data r)
Data r a
Applicative (Data r)
-> (forall a. Data r a)
-> (forall a. Data r a -> Data r a -> Data r a)
-> (forall a. Data r a -> Data r [a])
-> (forall a. Data r a -> Data r [a])
-> Alternative (Data r)
Data r a -> Data r a -> Data r a
Data r a -> Data r [a]
Data r a -> Data r [a]
forall a. Data r a
forall a. Data r a -> Data r [a]
forall a. Data r a -> Data r a -> Data r a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
forall (r :: * -> *). Alternative r => Applicative (Data r)
forall (r :: * -> *) a. Alternative r => Data r a
forall (r :: * -> *) a. Alternative r => Data r a -> Data r [a]
forall (r :: * -> *) a.
Alternative r =>
Data r a -> Data r a -> Data r a
many :: Data r a -> Data r [a]
$cmany :: forall (r :: * -> *) a. Alternative r => Data r a -> Data r [a]
some :: Data r a -> Data r [a]
$csome :: forall (r :: * -> *) a. Alternative r => Data r a -> Data r [a]
<|> :: Data r a -> Data r a -> Data r a
$c<|> :: forall (r :: * -> *) a.
Alternative r =>
Data r a -> Data r a -> Data r a
empty :: Data r a
$cempty :: forall (r :: * -> *) a. Alternative r => Data r a
$cp1Alternative :: forall (r :: * -> *). Alternative r => Applicative (Data r)
Alternative
           , Applicative (Data r)
a -> Data r a
Applicative (Data r)
-> (forall a b. Data r a -> (a -> Data r b) -> Data r b)
-> (forall a b. Data r a -> Data r b -> Data r b)
-> (forall a. a -> Data r a)
-> Monad (Data r)
Data r a -> (a -> Data r b) -> Data r b
Data r a -> Data r b -> Data r b
forall a. a -> Data r a
forall a b. Data r a -> Data r b -> Data r b
forall a b. Data r a -> (a -> Data r b) -> Data r b
forall (r :: * -> *). Monad r => Applicative (Data r)
forall (r :: * -> *) a. Monad r => a -> Data r a
forall (r :: * -> *) a b.
Monad r =>
Data r a -> Data r b -> Data r b
forall (r :: * -> *) a b.
Monad r =>
Data r a -> (a -> Data r b) -> Data r b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Data r a
$creturn :: forall (r :: * -> *) a. Monad r => a -> Data r a
>> :: Data r a -> Data r b -> Data r b
$c>> :: forall (r :: * -> *) a b.
Monad r =>
Data r a -> Data r b -> Data r b
>>= :: Data r a -> (a -> Data r b) -> Data r b
$c>>= :: forall (r :: * -> *) a b.
Monad r =>
Data r a -> (a -> Data r b) -> Data r b
$cp1Monad :: forall (r :: * -> *). Monad r => Applicative (Data r)
Monad, Monad (Data r)
Alternative (Data r)
Data r a
Alternative (Data r)
-> Monad (Data r)
-> (forall a. Data r a)
-> (forall a. Data r a -> Data r a -> Data r a)
-> MonadPlus (Data r)
Data r a -> Data r a -> Data r a
forall a. Data r a
forall a. Data r a -> Data r a -> Data r a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
forall (r :: * -> *). MonadPlus r => Monad (Data r)
forall (r :: * -> *). MonadPlus r => Alternative (Data r)
forall (r :: * -> *) a. MonadPlus r => Data r a
forall (r :: * -> *) a.
MonadPlus r =>
Data r a -> Data r a -> Data r a
mplus :: Data r a -> Data r a -> Data r a
$cmplus :: forall (r :: * -> *) a.
MonadPlus r =>
Data r a -> Data r a -> Data r a
mzero :: Data r a
$cmzero :: forall (r :: * -> *) a. MonadPlus r => Data r a
$cp2MonadPlus :: forall (r :: * -> *). MonadPlus r => Monad (Data r)
$cp1MonadPlus :: forall (r :: * -> *). MonadPlus r => Alternative (Data r)
MonadPlus, b -> Data r b -> Data r a
(a -> b) -> Data r b -> Data r a
(forall a b. (a -> b) -> Data r b -> Data r a)
-> (forall b a. b -> Data r b -> Data r a)
-> Contravariant (Data r)
forall b a. b -> Data r b -> Data r a
forall a b. (a -> b) -> Data r b -> Data r a
forall (r :: * -> *) b a.
Contravariant r =>
b -> Data r b -> Data r a
forall (r :: * -> *) a b.
Contravariant r =>
(a -> b) -> Data r b -> Data r a
forall (f :: * -> *).
(forall a b. (a -> b) -> f b -> f a)
-> (forall b a. b -> f b -> f a) -> Contravariant f
>$ :: b -> Data r b -> Data r a
$c>$ :: forall (r :: * -> *) b a.
Contravariant r =>
b -> Data r b -> Data r a
contramap :: (a -> b) -> Data r b -> Data r a
$ccontramap :: forall (r :: * -> *) a b.
Contravariant r =>
(a -> b) -> Data r b -> Data r a
Contravariant
           , Data r p -> Data r p -> Bool
(Data r p -> Data r p -> Bool)
-> (Data r p -> Data r p -> Bool) -> Eq (Data r p)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (r :: * -> *) p. Eq (r p) => Data r p -> Data r p -> Bool
/= :: Data r p -> Data r p -> Bool
$c/= :: forall (r :: * -> *) p. Eq (r p) => Data r p -> Data r p -> Bool
== :: Data r p -> Data r p -> Bool
$c== :: forall (r :: * -> *) p. Eq (r p) => Data r p -> Data r p -> Bool
Eq, Eq (Data r p)
Eq (Data r p)
-> (Data r p -> Data r p -> Ordering)
-> (Data r p -> Data r p -> Bool)
-> (Data r p -> Data r p -> Bool)
-> (Data r p -> Data r p -> Bool)
-> (Data r p -> Data r p -> Bool)
-> (Data r p -> Data r p -> Data r p)
-> (Data r p -> Data r p -> Data r p)
-> Ord (Data r p)
Data r p -> Data r p -> Bool
Data r p -> Data r p -> Ordering
Data r p -> Data r p -> Data r p
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (r :: * -> *) p. Ord (r p) => Eq (Data r p)
forall (r :: * -> *) p. Ord (r p) => Data r p -> Data r p -> Bool
forall (r :: * -> *) p.
Ord (r p) =>
Data r p -> Data r p -> Ordering
forall (r :: * -> *) p.
Ord (r p) =>
Data r p -> Data r p -> Data r p
min :: Data r p -> Data r p -> Data r p
$cmin :: forall (r :: * -> *) p.
Ord (r p) =>
Data r p -> Data r p -> Data r p
max :: Data r p -> Data r p -> Data r p
$cmax :: forall (r :: * -> *) p.
Ord (r p) =>
Data r p -> Data r p -> Data r p
>= :: Data r p -> Data r p -> Bool
$c>= :: forall (r :: * -> *) p. Ord (r p) => Data r p -> Data r p -> Bool
> :: Data r p -> Data r p -> Bool
$c> :: forall (r :: * -> *) p. Ord (r p) => Data r p -> Data r p -> Bool
<= :: Data r p -> Data r p -> Bool
$c<= :: forall (r :: * -> *) p. Ord (r p) => Data r p -> Data r p -> Bool
< :: Data r p -> Data r p -> Bool
$c< :: forall (r :: * -> *) p. Ord (r p) => Data r p -> Data r p -> Bool
compare :: Data r p -> Data r p -> Ordering
$ccompare :: forall (r :: * -> *) p.
Ord (r p) =>
Data r p -> Data r p -> Ordering
$cp1Ord :: forall (r :: * -> *) p. Ord (r p) => Eq (Data r p)
Ord, (a -> b -> Bool) -> Data r a -> Data r b -> Bool
(forall a b. (a -> b -> Bool) -> Data r a -> Data r b -> Bool)
-> Eq1 (Data r)
forall a b. (a -> b -> Bool) -> Data r a -> Data r b -> Bool
forall (r :: * -> *) a b.
Eq1 r =>
(a -> b -> Bool) -> Data r a -> Data r b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
liftEq :: (a -> b -> Bool) -> Data r a -> Data r b -> Bool
$cliftEq :: forall (r :: * -> *) a b.
Eq1 r =>
(a -> b -> Bool) -> Data r a -> Data r b -> Bool
Eq1, Eq1 (Data r)
Eq1 (Data r)
-> (forall a b.
    (a -> b -> Ordering) -> Data r a -> Data r b -> Ordering)
-> Ord1 (Data r)
(a -> b -> Ordering) -> Data r a -> Data r b -> Ordering
forall a b.
(a -> b -> Ordering) -> Data r a -> Data r b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
forall (r :: * -> *). Ord1 r => Eq1 (Data r)
forall (r :: * -> *) a b.
Ord1 r =>
(a -> b -> Ordering) -> Data r a -> Data r b -> Ordering
liftCompare :: (a -> b -> Ordering) -> Data r a -> Data r b -> Ordering
$cliftCompare :: forall (r :: * -> *) a b.
Ord1 r =>
(a -> b -> Ordering) -> Data r a -> Data r b -> Ordering
$cp1Ord1 :: forall (r :: * -> *). Ord1 r => Eq1 (Data r)
Ord1, b -> Data r p -> Data r p
NonEmpty (Data r p) -> Data r p
Data r p -> Data r p -> Data r p
(Data r p -> Data r p -> Data r p)
-> (NonEmpty (Data r p) -> Data r p)
-> (forall b. Integral b => b -> Data r p -> Data r p)
-> Semigroup (Data r p)
forall b. Integral b => b -> Data r p -> Data r p
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall (r :: * -> *) p.
Semigroup (r p) =>
NonEmpty (Data r p) -> Data r p
forall (r :: * -> *) p.
Semigroup (r p) =>
Data r p -> Data r p -> Data r p
forall (r :: * -> *) p b.
(Semigroup (r p), Integral b) =>
b -> Data r p -> Data r p
stimes :: b -> Data r p -> Data r p
$cstimes :: forall (r :: * -> *) p b.
(Semigroup (r p), Integral b) =>
b -> Data r p -> Data r p
sconcat :: NonEmpty (Data r p) -> Data r p
$csconcat :: forall (r :: * -> *) p.
Semigroup (r p) =>
NonEmpty (Data r p) -> Data r p
<> :: Data r p -> Data r p -> Data r p
$c<> :: forall (r :: * -> *) p.
Semigroup (r p) =>
Data r p -> Data r p -> Data r p
Semigroup, Semigroup (Data r p)
Data r p
Semigroup (Data r p)
-> Data r p
-> (Data r p -> Data r p -> Data r p)
-> ([Data r p] -> Data r p)
-> Monoid (Data r p)
[Data r p] -> Data r p
Data r p -> Data r p -> Data r p
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall (r :: * -> *) p. Monoid (r p) => Semigroup (Data r p)
forall (r :: * -> *) p. Monoid (r p) => Data r p
forall (r :: * -> *) p. Monoid (r p) => [Data r p] -> Data r p
forall (r :: * -> *) p.
Monoid (r p) =>
Data r p -> Data r p -> Data r p
mconcat :: [Data r p] -> Data r p
$cmconcat :: forall (r :: * -> *) p. Monoid (r p) => [Data r p] -> Data r p
mappend :: Data r p -> Data r p -> Data r p
$cmappend :: forall (r :: * -> *) p.
Monoid (r p) =>
Data r p -> Data r p -> Data r p
mempty :: Data r p
$cmempty :: forall (r :: * -> *) p. Monoid (r p) => Data r p
$cp1Monoid :: forall (r :: * -> *) p. Monoid (r p) => Semigroup (Data r p)
Monoid )

-- | Conversion between a generic type and the synthetic type made using its
-- representation. Inverse of 'fromData'.
toData :: Generic a => a -> Data (Rep a) p
toData :: a -> Data (Rep a) p
toData = Rep a p -> Data (Rep a) p
forall (r :: * -> *) p. r p -> Data r p
Data (Rep a p -> Data (Rep a) p)
-> (a -> Rep a p) -> a -> Data (Rep a) p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Rep a p
forall a x. Generic a => a -> Rep a x
from

-- | Inverse of 'toData'.
fromData :: Generic a => Data (Rep a) p -> a
fromData :: Data (Rep a) p -> a
fromData = Rep a p -> a
forall a x. Generic a => Rep a x -> a
to (Rep a p -> a)
-> (Data (Rep a) p -> Rep a p) -> Data (Rep a) p -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data (Rep a) p -> Rep a p
forall (r :: * -> *) p. Data r p -> r p
unData

instance (Functor r, Contravariant r) => Generic (Data r p) where
  type Rep (Data r p) = r
  to :: Rep (Data r p) x -> Data r p
to = r p -> Data r p
forall (r :: * -> *) p. r p -> Data r p
Data (r p -> Data r p) -> (r x -> r p) -> r x -> Data r p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. r x -> r p
forall (f :: * -> *) a b.
(Functor f, Contravariant f) =>
f a -> f b
phantom
  from :: Data r p -> Rep (Data r p) x
from = r p -> r x
forall (f :: * -> *) a b.
(Functor f, Contravariant f) =>
f a -> f b
phantom (r p -> r x) -> (Data r p -> r p) -> Data r p -> r x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data r p -> r p
forall (r :: * -> *) p. Data r p -> r p
unData

instance Generic1 (Data r) where
  type Rep1 (Data r) = r
  to1 :: Rep1 (Data r) a -> Data r a
to1 = Rep1 (Data r) a -> Data r a
forall (r :: * -> *) p. r p -> Data r p
Data
  from1 :: Data r a -> Rep1 (Data r) a
from1 = Data r a -> Rep1 (Data r) a
forall (r :: * -> *) p. Data r p -> r p
unData

instance (GShow1 r, Show p) => Show (Data r p) where
  showsPrec :: Int -> Data r p -> ShowS
showsPrec = (Data r p -> Int -> ShowS) -> Int -> Data r p -> ShowS
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Int -> p -> ShowS) -> ([p] -> ShowS) -> r p -> Int -> ShowS
forall (f :: * -> *) a.
GShow1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> f a -> Int -> ShowS
gLiftPrecShows Int -> p -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [p] -> ShowS
forall a. Show a => [a] -> ShowS
showList (r p -> Int -> ShowS)
-> (Data r p -> r p) -> Data r p -> Int -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data r p -> r p
forall (r :: * -> *) p. Data r p -> r p
unData)

instance GShow1 r => Show1 (Data r) where
  liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Data r a -> ShowS
liftShowsPrec = (((([a] -> ShowS) -> r a -> Int -> ShowS)
 -> ([a] -> ShowS) -> Int -> Data r a -> ShowS)
-> ((Int -> a -> ShowS) -> ([a] -> ShowS) -> r a -> Int -> ShowS)
-> (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> Int
-> Data r a
-> ShowS
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (((([a] -> ShowS) -> r a -> Int -> ShowS)
  -> ([a] -> ShowS) -> Int -> Data r a -> ShowS)
 -> ((Int -> a -> ShowS) -> ([a] -> ShowS) -> r a -> Int -> ShowS)
 -> (Int -> a -> ShowS)
 -> ([a] -> ShowS)
 -> Int
 -> Data r a
 -> ShowS)
-> (((r a -> Int -> ShowS) -> Int -> Data r a -> ShowS)
    -> (([a] -> ShowS) -> r a -> Int -> ShowS)
    -> ([a] -> ShowS)
    -> Int
    -> Data r a
    -> ShowS)
-> ((r a -> Int -> ShowS) -> Int -> Data r a -> ShowS)
-> ((Int -> a -> ShowS) -> ([a] -> ShowS) -> r a -> Int -> ShowS)
-> (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> Int
-> Data r a
-> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((r a -> Int -> ShowS) -> Int -> Data r a -> ShowS)
-> (([a] -> ShowS) -> r a -> Int -> ShowS)
-> ([a] -> ShowS)
-> Int
-> Data r a
-> ShowS
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap) ((Data r a -> Int -> ShowS) -> Int -> Data r a -> ShowS
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Data r a -> Int -> ShowS) -> Int -> Data r a -> ShowS)
-> ((r a -> Int -> ShowS) -> Data r a -> Int -> ShowS)
-> (r a -> Int -> ShowS)
-> Int
-> Data r a
-> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((r a -> Int -> ShowS)
-> (Data r a -> r a) -> Data r a -> Int -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data r a -> r a
forall (r :: * -> *) p. Data r p -> r p
unData)) (Int -> a -> ShowS) -> ([a] -> ShowS) -> r a -> Int -> ShowS
forall (f :: * -> *) a.
GShow1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> f a -> Int -> ShowS
gLiftPrecShows

instance GEnum StandardEnum r => Enum (Data r p) where
  toEnum :: Int -> Data r p
toEnum = r p -> Data r p
forall (r :: * -> *) p. r p -> Data r p
Data (r p -> Data r p) -> (Int -> r p) -> Int -> Data r p
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall opts (f :: * -> *) p. GEnum opts f => Int -> f p
forall (f :: * -> *) p. GEnum StandardEnum f => Int -> f p
gToEnum @StandardEnum
  fromEnum :: Data r p -> Int
fromEnum = forall opts (f :: * -> *) p. GEnum opts f => f p -> Int
forall (f :: * -> *) p. GEnum StandardEnum f => f p -> Int
gFromEnum @StandardEnum (r p -> Int) -> (Data r p -> r p) -> Data r p -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data r p -> r p
forall (r :: * -> *) p. Data r p -> r p
unData

instance GBounded r => Bounded (Data r p) where
  minBound :: Data r p
minBound = r p -> Data r p
forall (r :: * -> *) p. r p -> Data r p
Data r p
forall (f :: * -> *) p. GBounded f => f p
gMinBound
  maxBound :: Data r p
maxBound = r p -> Data r p
forall (r :: * -> *) p. r p -> Data r p
Data r p
forall (f :: * -> *) p. GBounded f => f p
gMaxBound