{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE DeriveGeneric #-}
module Data.Tuple.Solo (
Solo(Solo),
getSolo,
) where
#ifdef MIN_VERSION_base_orphans
import Data.Orphans ()
#endif
#if MIN_VERSION_base(4,16,0)
import GHC.Tuple (Solo (Solo), getSolo)
#elif MIN_VERSION_base(4,15,0)
import GHC.Tuple (Solo (Solo))
getSolo :: Solo a -> a
getSolo (Solo x) = x
#else
#if MIN_VERSION_base(4,9,0)
#define LIFTED_FUNCTOR_CLASSES 1
#else
#if MIN_VERSION_transformers(0,5,0)
#define LIFTED_FUNCTOR_CLASSES 1
#else
#ifdef MIN_VERSION_transformers_compat
#if MIN_VERSION_transformers_compat(0,5,0) && !(MIN_VERSION_transformers(0,4,0))
#define LIFTED_FUNCTOR_CLASSES 1
#endif
#endif
#endif
#endif
import Control.Applicative (Applicative (..))
import Control.Monad (ap)
import Control.Monad.Fix (MonadFix (..))
import Data.Data (Data)
import Data.Foldable (Foldable (..))
import Data.Ix (Ix (..))
import Data.Monoid (Monoid (..))
import Data.Semigroup (Semigroup (..))
import Data.Traversable (Traversable (..))
import Data.Typeable (Typeable)
import Data.Functor.Classes (Eq1 (..), Ord1 (..), Show1 (..), Read1 (..))
#if !(MIN_VERSION_base(4,15,0))
import Data.Hashable (Hashable (..))
import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1)
#endif
#if LIFTED_FUNCTOR_CLASSES
#if MIN_VERSION_base(4,10,0)
import Data.Functor.Classes (readData, readUnaryWith, liftReadListDefault, liftReadListPrecDefault)
#else
import Data.Functor.Classes (readsData, readsUnaryWith)
#endif
#endif
import GHC.Generics (Generic, Generic1)
import Control.Monad.Zip (MonadZip (..))
data Solo a = Solo { Solo a -> a
getSolo :: a }
deriving
( Solo a -> Solo a -> Bool
(Solo a -> Solo a -> Bool)
-> (Solo a -> Solo a -> Bool) -> Eq (Solo a)
forall a. Eq a => Solo a -> Solo a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Solo a -> Solo a -> Bool
$c/= :: forall a. Eq a => Solo a -> Solo a -> Bool
== :: Solo a -> Solo a -> Bool
$c== :: forall a. Eq a => Solo a -> Solo a -> Bool
Eq,Eq (Solo a)
Eq (Solo a)
-> (Solo a -> Solo a -> Ordering)
-> (Solo a -> Solo a -> Bool)
-> (Solo a -> Solo a -> Bool)
-> (Solo a -> Solo a -> Bool)
-> (Solo a -> Solo a -> Bool)
-> (Solo a -> Solo a -> Solo a)
-> (Solo a -> Solo a -> Solo a)
-> Ord (Solo a)
Solo a -> Solo a -> Bool
Solo a -> Solo a -> Ordering
Solo a -> Solo a -> Solo a
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 a. Ord a => Eq (Solo a)
forall a. Ord a => Solo a -> Solo a -> Bool
forall a. Ord a => Solo a -> Solo a -> Ordering
forall a. Ord a => Solo a -> Solo a -> Solo a
min :: Solo a -> Solo a -> Solo a
$cmin :: forall a. Ord a => Solo a -> Solo a -> Solo a
max :: Solo a -> Solo a -> Solo a
$cmax :: forall a. Ord a => Solo a -> Solo a -> Solo a
>= :: Solo a -> Solo a -> Bool
$c>= :: forall a. Ord a => Solo a -> Solo a -> Bool
> :: Solo a -> Solo a -> Bool
$c> :: forall a. Ord a => Solo a -> Solo a -> Bool
<= :: Solo a -> Solo a -> Bool
$c<= :: forall a. Ord a => Solo a -> Solo a -> Bool
< :: Solo a -> Solo a -> Bool
$c< :: forall a. Ord a => Solo a -> Solo a -> Bool
compare :: Solo a -> Solo a -> Ordering
$ccompare :: forall a. Ord a => Solo a -> Solo a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Solo a)
Ord,Solo a
Solo a -> Solo a -> Bounded (Solo a)
forall a. a -> a -> Bounded a
forall a. Bounded a => Solo a
maxBound :: Solo a
$cmaxBound :: forall a. Bounded a => Solo a
minBound :: Solo a
$cminBound :: forall a. Bounded a => Solo a
Bounded,ReadPrec [Solo a]
ReadPrec (Solo a)
Int -> ReadS (Solo a)
ReadS [Solo a]
(Int -> ReadS (Solo a))
-> ReadS [Solo a]
-> ReadPrec (Solo a)
-> ReadPrec [Solo a]
-> Read (Solo a)
forall a. Read a => ReadPrec [Solo a]
forall a. Read a => ReadPrec (Solo a)
forall a. Read a => Int -> ReadS (Solo a)
forall a. Read a => ReadS [Solo a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Solo a]
$creadListPrec :: forall a. Read a => ReadPrec [Solo a]
readPrec :: ReadPrec (Solo a)
$creadPrec :: forall a. Read a => ReadPrec (Solo a)
readList :: ReadS [Solo a]
$creadList :: forall a. Read a => ReadS [Solo a]
readsPrec :: Int -> ReadS (Solo a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Solo a)
Read,Typeable,Typeable (Solo a)
DataType
Constr
Typeable (Solo a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Solo a -> c (Solo a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Solo a))
-> (Solo a -> Constr)
-> (Solo a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Solo a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Solo a)))
-> ((forall b. Data b => b -> b) -> Solo a -> Solo a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Solo a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Solo a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Solo a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Solo a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a))
-> Data (Solo a)
Solo a -> DataType
Solo a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Solo a))
(forall b. Data b => b -> b) -> Solo a -> Solo a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Solo a -> c (Solo a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Solo a)
forall a. Data a => Typeable (Solo a)
forall a. Data a => Solo a -> DataType
forall a. Data a => Solo a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Solo a -> Solo a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Solo a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> Solo a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Solo a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Solo a -> c (Solo a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Solo a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Solo a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Solo a -> u
forall u. (forall d. Data d => d -> u) -> Solo a -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Solo a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Solo a -> c (Solo a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Solo a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Solo a))
$cSolo :: Constr
$tSolo :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
gmapMp :: (forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
gmapM :: (forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Solo a -> m (Solo a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Solo a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Solo a -> u
gmapQ :: (forall d. Data d => d -> u) -> Solo a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> Solo a -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Solo a -> r
gmapT :: (forall b. Data b => b -> b) -> Solo a -> Solo a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Solo a -> Solo a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Solo a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Solo a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Solo a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Solo a))
dataTypeOf :: Solo a -> DataType
$cdataTypeOf :: forall a. Data a => Solo a -> DataType
toConstr :: Solo a -> Constr
$ctoConstr :: forall a. Data a => Solo a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Solo a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Solo a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Solo a -> c (Solo a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Solo a -> c (Solo a)
$cp1Data :: forall a. Data a => Typeable (Solo a)
Data
, (forall x. Solo a -> Rep (Solo a) x)
-> (forall x. Rep (Solo a) x -> Solo a) -> Generic (Solo a)
forall x. Rep (Solo a) x -> Solo a
forall x. Solo a -> Rep (Solo a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Solo a) x -> Solo a
forall a x. Solo a -> Rep (Solo a) x
$cto :: forall a x. Rep (Solo a) x -> Solo a
$cfrom :: forall a x. Solo a -> Rep (Solo a) x
Generic
#if __GLASGOW_HASKELL__ >=706
, (forall a. Solo a -> Rep1 Solo a)
-> (forall a. Rep1 Solo a -> Solo a) -> Generic1 Solo
forall a. Rep1 Solo a -> Solo a
forall a. Solo a -> Rep1 Solo a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Solo a -> Solo a
$cfrom1 :: forall a. Solo a -> Rep1 Solo a
Generic1
#endif
)
instance Show a => Show (Solo a) where
showsPrec :: Int -> Solo a -> ShowS
showsPrec Int
d (Solo a
x) = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"Solo " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 a
x
instance (Enum a) => Enum (Solo a) where
succ :: Solo a -> Solo a
succ = (a -> a) -> Solo a -> Solo a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Enum a => a -> a
succ
pred :: Solo a -> Solo a
pred = (a -> a) -> Solo a -> Solo a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Enum a => a -> a
pred
toEnum :: Int -> Solo a
toEnum = a -> Solo a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> Solo a) -> (Int -> a) -> Int -> Solo a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a
forall a. Enum a => Int -> a
toEnum
fromEnum :: Solo a -> Int
fromEnum (Solo a
x) = a -> Int
forall a. Enum a => a -> Int
fromEnum a
x
instance (Ix a) => Ix (Solo a) where
range :: (Solo a, Solo a) -> [Solo a]
range (Solo a
x, Solo a
y) = (a -> Solo a) -> [a] -> [Solo a]
forall a b. (a -> b) -> [a] -> [b]
map a -> Solo a
forall a. a -> Solo a
Solo ((a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range (a
x,a
y))
index :: (Solo a, Solo a) -> Solo a -> Int
index (Solo a
x, Solo a
y) (Solo a
z) = (a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
index (a
x,a
y) a
z
inRange :: (Solo a, Solo a) -> Solo a -> Bool
inRange (Solo a
x, Solo a
y) (Solo a
z) = (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
x,a
y) a
z
instance Foldable Solo where
fold :: Solo m -> m
fold (Solo m
m) = m
m
foldMap :: (a -> m) -> Solo a -> m
foldMap a -> m
f (Solo a
x) = a -> m
f a
x
foldr :: (a -> b -> b) -> b -> Solo a -> b
foldr a -> b -> b
f b
b (Solo a
x) = a -> b -> b
f a
x b
b
foldl :: (b -> a -> b) -> b -> Solo a -> b
foldl b -> a -> b
f b
a (Solo a
x) = b -> a -> b
f b
a a
x
foldr1 :: (a -> a -> a) -> Solo a -> a
foldr1 a -> a -> a
_f (Solo a
x) = a
x
foldl1 :: (a -> a -> a) -> Solo a -> a
foldl1 a -> a -> a
_f (Solo a
x) = a
x
#if MIN_VERSION_base(4,8,0)
null :: Solo a -> Bool
null Solo a
_ = Bool
False
length :: Solo a -> Int
length Solo a
_ = Int
1
maximum :: Solo a -> a
maximum = Solo a -> a
forall a. Solo a -> a
getSolo
minimum :: Solo a -> a
minimum = Solo a -> a
forall a. Solo a -> a
getSolo
sum :: Solo a -> a
sum = Solo a -> a
forall a. Solo a -> a
getSolo
product :: Solo a -> a
product = Solo a -> a
forall a. Solo a -> a
getSolo
toList :: Solo a -> [a]
toList (Solo a
a) = [a
a]
#endif
instance Traversable Solo where
traverse :: (a -> f b) -> Solo a -> f (Solo b)
traverse a -> f b
f (Solo a
x) = (b -> Solo b) -> f b -> f (Solo b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap b -> Solo b
forall a. a -> Solo a
Solo (a -> f b
f a
x)
sequenceA :: Solo (f a) -> f (Solo a)
sequenceA (Solo f a
x) = (a -> Solo a) -> f a -> f (Solo a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> Solo a
forall a. a -> Solo a
Solo f a
x
instance Functor Solo where
fmap :: (a -> b) -> Solo a -> Solo b
fmap a -> b
f (Solo a
x) = b -> Solo b
forall a. a -> Solo a
Solo (a -> b
f a
x)
instance Applicative Solo where
pure :: a -> Solo a
pure = a -> Solo a
forall a. a -> Solo a
Solo
Solo a -> b
f <*> :: Solo (a -> b) -> Solo a -> Solo b
<*> Solo a
x = b -> Solo b
forall a. a -> Solo a
Solo (a -> b
f a
x)
Solo a
_ *> :: Solo a -> Solo b -> Solo b
*> Solo b
x = Solo b
x
Solo a
x <* :: Solo a -> Solo b -> Solo a
<* Solo b
_ = Solo a
x
#if MIN_VERSION_base(4,10,0)
liftA2 :: (a -> b -> c) -> Solo a -> Solo b -> Solo c
liftA2 a -> b -> c
f (Solo a
x) (Solo b
y) = c -> Solo c
forall a. a -> Solo a
Solo (a -> b -> c
f a
x b
y)
#endif
instance Monad Solo where
return :: a -> Solo a
return = a -> Solo a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
>> :: Solo a -> Solo b -> Solo b
(>>) = Solo a -> Solo b -> Solo b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
(*>)
Solo a
x >>= :: Solo a -> (a -> Solo b) -> Solo b
>>= a -> Solo b
f = a -> Solo b
f a
x
instance Semigroup a => Semigroup (Solo a) where
Solo a
x <> :: Solo a -> Solo a -> Solo a
<> Solo a
y = a -> Solo a
forall a. a -> Solo a
Solo (a
x a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
y)
instance Monoid a => Monoid (Solo a) where
mempty :: Solo a
mempty = a -> Solo a
forall a. a -> Solo a
Solo a
forall a. Monoid a => a
mempty
mappend :: Solo a -> Solo a -> Solo a
mappend (Solo a
x) (Solo a
y) = a -> Solo a
forall a. a -> Solo a
Solo (a -> a -> a
forall a. Monoid a => a -> a -> a
mappend a
x a
y)
instance MonadFix Solo where
mfix :: (a -> Solo a) -> Solo a
mfix a -> Solo a
f = let a :: Solo a
a = a -> Solo a
f (Solo a -> a
forall a. Solo a -> a
getSolo Solo a
a) in Solo a
a
instance MonadZip Solo where
mzipWith :: (a -> b -> c) -> Solo a -> Solo b -> Solo c
mzipWith a -> b -> c
f (Solo a
a) (Solo b
b) = c -> Solo c
forall a. a -> Solo a
Solo (a -> b -> c
f a
a b
b)
#ifdef LIFTED_FUNCTOR_CLASSES
instance Eq1 Solo where
liftEq :: (a -> b -> Bool) -> Solo a -> Solo b -> Bool
liftEq a -> b -> Bool
eq (Solo a
a) (Solo b
b) = a
a a -> b -> Bool
`eq` b
b
instance Ord1 Solo where
liftCompare :: (a -> b -> Ordering) -> Solo a -> Solo b -> Ordering
liftCompare a -> b -> Ordering
cmp (Solo a
a) (Solo b
b) = a -> b -> Ordering
cmp a
a b
b
instance Read1 Solo where
#if MIN_VERSION_base(4,10,0)
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Solo a)
liftReadPrec ReadPrec a
rp ReadPrec [a]
_ = ReadPrec (Solo a) -> ReadPrec (Solo a)
forall a. ReadPrec a -> ReadPrec a
readData (ReadPrec a -> String -> (a -> Solo a) -> ReadPrec (Solo a)
forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith ReadPrec a
rp String
"Solo" a -> Solo a
forall a. a -> Solo a
Solo)
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Solo a]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [Solo a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Solo a]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [Solo a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
#else
liftReadsPrec rp _ = readsData $ readsUnaryWith rp "Solo" Solo
#endif
instance Show1 Solo where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Solo a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
_ Int
d (Solo a
x) = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"Solo " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
sp Int
11 a
x
#else
instance Eq1 Solo where eq1 = (==)
instance Ord1 Solo where compare1 = compare
instance Read1 Solo where readsPrec1 = readsPrec
instance Show1 Solo where showsPrec1 = showsPrec
#endif
#endif
#if !(MIN_VERSION_base(4,15,0))
instance Hashable a => Hashable (Solo a) where
hashWithSalt :: Int -> Solo a -> Int
hashWithSalt = Int -> Solo a -> Int
forall (f :: * -> *) a.
(Hashable1 f, Hashable a) =>
Int -> f a -> Int
hashWithSalt1
instance Hashable1 Solo where
liftHashWithSalt :: (Int -> a -> Int) -> Int -> Solo a -> Int
liftHashWithSalt Int -> a -> Int
h Int
salt (Solo a
a) = Int -> a -> Int
h Int
salt a
a
#endif