{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Trustworthy #-}
#ifndef MIN_VERSION_semigroups
#define MIN_VERSION_semigroups(a,b,c) 0
#endif
module Codec.QRCode.Data.Result
( Result(..)
, result
) where
import Control.Applicative
import Control.Monad
import Control.Monad.Fix
import Data.Data
import Data.Semigroup
import GHC.Generics
#if !(MIN_VERSION_base(4,8,0))
import Data.Foldable
import Data.Traversable
#endif
#if (MIN_VERSION_base(4,9,0))
import Control.Monad.Zip
import Data.Functor.Classes
#endif
#if (MIN_VERSION_base(4,9,0)) && !(MIN_VERSION_base(4,13,0))
import Control.Monad.Fail
#endif
newtype Result a
= Result
{ Result a -> Maybe a
getResult :: Maybe a
}
deriving
( Applicative Result
Result a
Applicative Result
-> (forall a. Result a)
-> (forall a. Result a -> Result a -> Result a)
-> (forall a. Result a -> Result [a])
-> (forall a. Result a -> Result [a])
-> Alternative Result
Result a -> Result a -> Result a
Result a -> Result [a]
Result a -> Result [a]
forall a. Result a
forall a. Result a -> Result [a]
forall a. Result a -> Result a -> Result 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
many :: Result a -> Result [a]
$cmany :: forall a. Result a -> Result [a]
some :: Result a -> Result [a]
$csome :: forall a. Result a -> Result [a]
<|> :: Result a -> Result a -> Result a
$c<|> :: forall a. Result a -> Result a -> Result a
empty :: Result a
$cempty :: forall a. Result a
$cp1Alternative :: Applicative Result
Alternative, Functor Result
a -> Result a
Functor Result
-> (forall a. a -> Result a)
-> (forall a b. Result (a -> b) -> Result a -> Result b)
-> (forall a b c.
(a -> b -> c) -> Result a -> Result b -> Result c)
-> (forall a b. Result a -> Result b -> Result b)
-> (forall a b. Result a -> Result b -> Result a)
-> Applicative Result
Result a -> Result b -> Result b
Result a -> Result b -> Result a
Result (a -> b) -> Result a -> Result b
(a -> b -> c) -> Result a -> Result b -> Result c
forall a. a -> Result a
forall a b. Result a -> Result b -> Result a
forall a b. Result a -> Result b -> Result b
forall a b. Result (a -> b) -> Result a -> Result b
forall a b c. (a -> b -> c) -> Result a -> Result b -> Result 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
<* :: Result a -> Result b -> Result a
$c<* :: forall a b. Result a -> Result b -> Result a
*> :: Result a -> Result b -> Result b
$c*> :: forall a b. Result a -> Result b -> Result b
liftA2 :: (a -> b -> c) -> Result a -> Result b -> Result c
$cliftA2 :: forall a b c. (a -> b -> c) -> Result a -> Result b -> Result c
<*> :: Result (a -> b) -> Result a -> Result b
$c<*> :: forall a b. Result (a -> b) -> Result a -> Result b
pure :: a -> Result a
$cpure :: forall a. a -> Result a
$cp1Applicative :: Functor Result
Applicative, Typeable (Result a)
DataType
Constr
Typeable (Result a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result a -> c (Result a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Result a))
-> (Result a -> Constr)
-> (Result a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Result a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Result a)))
-> ((forall b. Data b => b -> b) -> Result a -> Result a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Result a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Result a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a))
-> Data (Result a)
Result a -> DataType
Result a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Result a))
(forall b. Data b => b -> b) -> Result a -> Result a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result a -> c (Result a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Result a)
forall a. Data a => Typeable (Result a)
forall a. Data a => Result a -> DataType
forall a. Data a => Result a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Result a -> Result a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Result a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Result a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Result a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result a -> c (Result a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Result a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Result 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) -> Result a -> u
forall u. (forall d. Data d => d -> u) -> Result a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Result a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result a -> c (Result a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Result a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Result a))
$cResult :: Constr
$tResult :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Result a -> m (Result a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
gmapMp :: (forall d. Data d => d -> m d) -> Result a -> m (Result a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
gmapM :: (forall d. Data d => d -> m d) -> Result a -> m (Result a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Result a -> m (Result a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Result a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Result a -> u
gmapQ :: (forall d. Data d => d -> u) -> Result a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Result a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Result a -> r
gmapT :: (forall b. Data b => b -> b) -> Result a -> Result a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Result a -> Result a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Result a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Result a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Result a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Result a))
dataTypeOf :: Result a -> DataType
$cdataTypeOf :: forall a. Data a => Result a -> DataType
toConstr :: Result a -> Constr
$ctoConstr :: forall a. Data a => Result a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Result a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Result a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result a -> c (Result a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Result a -> c (Result a)
$cp1Data :: forall a. Data a => Typeable (Result a)
Data, Result a -> Result a -> Bool
(Result a -> Result a -> Bool)
-> (Result a -> Result a -> Bool) -> Eq (Result a)
forall a. Eq a => Result a -> Result a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Result a -> Result a -> Bool
$c/= :: forall a. Eq a => Result a -> Result a -> Bool
== :: Result a -> Result a -> Bool
$c== :: forall a. Eq a => Result a -> Result a -> Bool
Eq, a -> Result a -> Bool
Result m -> m
Result a -> [a]
Result a -> Bool
Result a -> Int
Result a -> a
Result a -> a
Result a -> a
Result a -> a
(a -> m) -> Result a -> m
(a -> m) -> Result a -> m
(a -> b -> b) -> b -> Result a -> b
(a -> b -> b) -> b -> Result a -> b
(b -> a -> b) -> b -> Result a -> b
(b -> a -> b) -> b -> Result a -> b
(a -> a -> a) -> Result a -> a
(a -> a -> a) -> Result a -> a
(forall m. Monoid m => Result m -> m)
-> (forall m a. Monoid m => (a -> m) -> Result a -> m)
-> (forall m a. Monoid m => (a -> m) -> Result a -> m)
-> (forall a b. (a -> b -> b) -> b -> Result a -> b)
-> (forall a b. (a -> b -> b) -> b -> Result a -> b)
-> (forall b a. (b -> a -> b) -> b -> Result a -> b)
-> (forall b a. (b -> a -> b) -> b -> Result a -> b)
-> (forall a. (a -> a -> a) -> Result a -> a)
-> (forall a. (a -> a -> a) -> Result a -> a)
-> (forall a. Result a -> [a])
-> (forall a. Result a -> Bool)
-> (forall a. Result a -> Int)
-> (forall a. Eq a => a -> Result a -> Bool)
-> (forall a. Ord a => Result a -> a)
-> (forall a. Ord a => Result a -> a)
-> (forall a. Num a => Result a -> a)
-> (forall a. Num a => Result a -> a)
-> Foldable Result
forall a. Eq a => a -> Result a -> Bool
forall a. Num a => Result a -> a
forall a. Ord a => Result a -> a
forall m. Monoid m => Result m -> m
forall a. Result a -> Bool
forall a. Result a -> Int
forall a. Result a -> [a]
forall a. (a -> a -> a) -> Result a -> a
forall m a. Monoid m => (a -> m) -> Result a -> m
forall b a. (b -> a -> b) -> b -> Result a -> b
forall a b. (a -> b -> b) -> b -> Result 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 :: Result a -> a
$cproduct :: forall a. Num a => Result a -> a
sum :: Result a -> a
$csum :: forall a. Num a => Result a -> a
minimum :: Result a -> a
$cminimum :: forall a. Ord a => Result a -> a
maximum :: Result a -> a
$cmaximum :: forall a. Ord a => Result a -> a
elem :: a -> Result a -> Bool
$celem :: forall a. Eq a => a -> Result a -> Bool
length :: Result a -> Int
$clength :: forall a. Result a -> Int
null :: Result a -> Bool
$cnull :: forall a. Result a -> Bool
toList :: Result a -> [a]
$ctoList :: forall a. Result a -> [a]
foldl1 :: (a -> a -> a) -> Result a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Result a -> a
foldr1 :: (a -> a -> a) -> Result a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Result a -> a
foldl' :: (b -> a -> b) -> b -> Result a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Result a -> b
foldl :: (b -> a -> b) -> b -> Result a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Result a -> b
foldr' :: (a -> b -> b) -> b -> Result a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Result a -> b
foldr :: (a -> b -> b) -> b -> Result a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Result a -> b
foldMap' :: (a -> m) -> Result a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Result a -> m
foldMap :: (a -> m) -> Result a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Result a -> m
fold :: Result m -> m
$cfold :: forall m. Monoid m => Result m -> m
Foldable, a -> Result b -> Result a
(a -> b) -> Result a -> Result b
(forall a b. (a -> b) -> Result a -> Result b)
-> (forall a b. a -> Result b -> Result a) -> Functor Result
forall a b. a -> Result b -> Result a
forall a b. (a -> b) -> Result a -> Result b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Result b -> Result a
$c<$ :: forall a b. a -> Result b -> Result a
fmap :: (a -> b) -> Result a -> Result b
$cfmap :: forall a b. (a -> b) -> Result a -> Result b
Functor
, (forall x. Result a -> Rep (Result a) x)
-> (forall x. Rep (Result a) x -> Result a) -> Generic (Result a)
forall x. Rep (Result a) x -> Result a
forall x. Result a -> Rep (Result a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Result a) x -> Result a
forall a x. Result a -> Rep (Result a) x
$cto :: forall a x. Rep (Result a) x -> Result a
$cfrom :: forall a x. Result a -> Rep (Result a) x
Generic, (forall a. Result a -> Rep1 Result a)
-> (forall a. Rep1 Result a -> Result a) -> Generic1 Result
forall a. Rep1 Result a -> Result a
forall a. Result a -> Rep1 Result 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 Result a -> Result a
$cfrom1 :: forall a. Result a -> Rep1 Result a
Generic1, Applicative Result
a -> Result a
Applicative Result
-> (forall a b. Result a -> (a -> Result b) -> Result b)
-> (forall a b. Result a -> Result b -> Result b)
-> (forall a. a -> Result a)
-> Monad Result
Result a -> (a -> Result b) -> Result b
Result a -> Result b -> Result b
forall a. a -> Result a
forall a b. Result a -> Result b -> Result b
forall a b. Result a -> (a -> Result b) -> Result 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 -> Result a
$creturn :: forall a. a -> Result a
>> :: Result a -> Result b -> Result b
$c>> :: forall a b. Result a -> Result b -> Result b
>>= :: Result a -> (a -> Result b) -> Result b
$c>>= :: forall a b. Result a -> (a -> Result b) -> Result b
$cp1Monad :: Applicative Result
Monad, Monad Result
Monad Result
-> (forall a. (a -> Result a) -> Result a) -> MonadFix Result
(a -> Result a) -> Result a
forall a. (a -> Result a) -> Result a
forall (m :: * -> *).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
mfix :: (a -> Result a) -> Result a
$cmfix :: forall a. (a -> Result a) -> Result a
$cp1MonadFix :: Monad Result
MonadFix, Monad Result
Alternative Result
Result a
Alternative Result
-> Monad Result
-> (forall a. Result a)
-> (forall a. Result a -> Result a -> Result a)
-> MonadPlus Result
Result a -> Result a -> Result a
forall a. Result a
forall a. Result a -> Result a -> Result a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
mplus :: Result a -> Result a -> Result a
$cmplus :: forall a. Result a -> Result a -> Result a
mzero :: Result a
$cmzero :: forall a. Result a
$cp2MonadPlus :: Monad Result
$cp1MonadPlus :: Alternative Result
MonadPlus
, Eq (Result a)
Eq (Result a)
-> (Result a -> Result a -> Ordering)
-> (Result a -> Result a -> Bool)
-> (Result a -> Result a -> Bool)
-> (Result a -> Result a -> Bool)
-> (Result a -> Result a -> Bool)
-> (Result a -> Result a -> Result a)
-> (Result a -> Result a -> Result a)
-> Ord (Result a)
Result a -> Result a -> Bool
Result a -> Result a -> Ordering
Result a -> Result a -> Result 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 (Result a)
forall a. Ord a => Result a -> Result a -> Bool
forall a. Ord a => Result a -> Result a -> Ordering
forall a. Ord a => Result a -> Result a -> Result a
min :: Result a -> Result a -> Result a
$cmin :: forall a. Ord a => Result a -> Result a -> Result a
max :: Result a -> Result a -> Result a
$cmax :: forall a. Ord a => Result a -> Result a -> Result a
>= :: Result a -> Result a -> Bool
$c>= :: forall a. Ord a => Result a -> Result a -> Bool
> :: Result a -> Result a -> Bool
$c> :: forall a. Ord a => Result a -> Result a -> Bool
<= :: Result a -> Result a -> Bool
$c<= :: forall a. Ord a => Result a -> Result a -> Bool
< :: Result a -> Result a -> Bool
$c< :: forall a. Ord a => Result a -> Result a -> Bool
compare :: Result a -> Result a -> Ordering
$ccompare :: forall a. Ord a => Result a -> Result a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Result a)
Ord, ReadPrec [Result a]
ReadPrec (Result a)
Int -> ReadS (Result a)
ReadS [Result a]
(Int -> ReadS (Result a))
-> ReadS [Result a]
-> ReadPrec (Result a)
-> ReadPrec [Result a]
-> Read (Result a)
forall a. Read a => ReadPrec [Result a]
forall a. Read a => ReadPrec (Result a)
forall a. Read a => Int -> ReadS (Result a)
forall a. Read a => ReadS [Result a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Result a]
$creadListPrec :: forall a. Read a => ReadPrec [Result a]
readPrec :: ReadPrec (Result a)
$creadPrec :: forall a. Read a => ReadPrec (Result a)
readList :: ReadS [Result a]
$creadList :: forall a. Read a => ReadS [Result a]
readsPrec :: Int -> ReadS (Result a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Result a)
Read, Int -> Result a -> ShowS
[Result a] -> ShowS
Result a -> String
(Int -> Result a -> ShowS)
-> (Result a -> String) -> ([Result a] -> ShowS) -> Show (Result a)
forall a. Show a => Int -> Result a -> ShowS
forall a. Show a => [Result a] -> ShowS
forall a. Show a => Result a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Result a] -> ShowS
$cshowList :: forall a. Show a => [Result a] -> ShowS
show :: Result a -> String
$cshow :: forall a. Show a => Result a -> String
showsPrec :: Int -> Result a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Result a -> ShowS
Show, Functor Result
Foldable Result
Functor Result
-> Foldable Result
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Result a -> f (Result b))
-> (forall (f :: * -> *) a.
Applicative f =>
Result (f a) -> f (Result a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Result a -> m (Result b))
-> (forall (m :: * -> *) a.
Monad m =>
Result (m a) -> m (Result a))
-> Traversable Result
(a -> f b) -> Result a -> f (Result 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 (m :: * -> *) a. Monad m => Result (m a) -> m (Result a)
forall (f :: * -> *) a.
Applicative f =>
Result (f a) -> f (Result a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Result a -> m (Result b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Result a -> f (Result b)
sequence :: Result (m a) -> m (Result a)
$csequence :: forall (m :: * -> *) a. Monad m => Result (m a) -> m (Result a)
mapM :: (a -> m b) -> Result a -> m (Result b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Result a -> m (Result b)
sequenceA :: Result (f a) -> f (Result a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Result (f a) -> f (Result a)
traverse :: (a -> f b) -> Result a -> f (Result b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Result a -> f (Result b)
$cp2Traversable :: Foldable Result
$cp1Traversable :: Functor Result
Traversable, Typeable
#if (MIN_VERSION_base(4,9,0))
, (a -> b -> Bool) -> Result a -> Result b -> Bool
(forall a b. (a -> b -> Bool) -> Result a -> Result b -> Bool)
-> Eq1 Result
forall a b. (a -> b -> Bool) -> Result a -> Result b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
liftEq :: (a -> b -> Bool) -> Result a -> Result b -> Bool
$cliftEq :: forall a b. (a -> b -> Bool) -> Result a -> Result b -> Bool
Eq1, Monad Result
Monad Result -> (forall a. String -> Result a) -> MonadFail Result
String -> Result a
forall a. String -> Result a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
fail :: String -> Result a
$cfail :: forall a. String -> Result a
$cp1MonadFail :: Monad Result
MonadFail, Monad Result
Monad Result
-> (forall a b. Result a -> Result b -> Result (a, b))
-> (forall a b c.
(a -> b -> c) -> Result a -> Result b -> Result c)
-> (forall a b. Result (a, b) -> (Result a, Result b))
-> MonadZip Result
Result a -> Result b -> Result (a, b)
Result (a, b) -> (Result a, Result b)
(a -> b -> c) -> Result a -> Result b -> Result c
forall a b. Result a -> Result b -> Result (a, b)
forall a b. Result (a, b) -> (Result a, Result b)
forall a b c. (a -> b -> c) -> Result a -> Result b -> Result c
forall (m :: * -> *).
Monad m
-> (forall a b. m a -> m b -> m (a, b))
-> (forall a b c. (a -> b -> c) -> m a -> m b -> m c)
-> (forall a b. m (a, b) -> (m a, m b))
-> MonadZip m
munzip :: Result (a, b) -> (Result a, Result b)
$cmunzip :: forall a b. Result (a, b) -> (Result a, Result b)
mzipWith :: (a -> b -> c) -> Result a -> Result b -> Result c
$cmzipWith :: forall a b c. (a -> b -> c) -> Result a -> Result b -> Result c
mzip :: Result a -> Result b -> Result (a, b)
$cmzip :: forall a b. Result a -> Result b -> Result (a, b)
$cp1MonadZip :: Monad Result
MonadZip, Eq1 Result
Eq1 Result
-> (forall a b.
(a -> b -> Ordering) -> Result a -> Result b -> Ordering)
-> Ord1 Result
(a -> b -> Ordering) -> Result a -> Result b -> Ordering
forall a b.
(a -> b -> Ordering) -> Result a -> Result b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
liftCompare :: (a -> b -> Ordering) -> Result a -> Result b -> Ordering
$cliftCompare :: forall a b.
(a -> b -> Ordering) -> Result a -> Result b -> Ordering
$cp1Ord1 :: Eq1 Result
Ord1, ReadPrec a -> ReadPrec [a] -> ReadPrec (Result a)
ReadPrec a -> ReadPrec [a] -> ReadPrec [Result a]
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Result a)
(Int -> ReadS a) -> ReadS [a] -> ReadS [Result a]
(forall a.
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Result a))
-> (forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Result a])
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Result a))
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Result a])
-> Read1 Result
forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Result a]
forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Result a)
forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Result a)
forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Result a]
forall (f :: * -> *).
(forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a))
-> (forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [f a])
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a))
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [f a])
-> Read1 f
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Result a]
$cliftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Result a]
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Result a)
$cliftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Result a)
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Result a]
$cliftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Result a]
liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Result a)
$cliftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Result a)
Read1, (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Result a -> ShowS
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Result a] -> ShowS
(forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Result a -> ShowS)
-> (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Result a] -> ShowS)
-> Show1 Result
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Result a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Result a] -> ShowS
forall (f :: * -> *).
(forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS)
-> (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS)
-> Show1 f
liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Result a] -> ShowS
$cliftShowList :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Result a] -> ShowS
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Result a -> ShowS
$cliftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Result a -> ShowS
Show1
#endif
)
instance Semigroup a => Semigroup (Result a) where
(Result (Just a
a)) <> :: Result a -> Result a -> Result a
<> (Result (Just a
b)) = Maybe a -> Result a
forall a. Maybe a -> Result a
Result (a -> Maybe a
forall a. a -> Maybe a
Just (a
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
b))
Result a
_ <> Result a
_ = Maybe a -> Result a
forall a. Maybe a -> Result a
Result Maybe a
forall a. Maybe a
Nothing
#if (MIN_VERSION_semigroups(0,17,0)) || (MIN_VERSION_base(4,9,0))
stimes :: b -> Result a -> Result a
stimes b
n (Result (Just a
a)) = Maybe a -> Result a
forall a. Maybe a -> Result a
Result (a -> Maybe a
forall a. a -> Maybe a
Just (b -> a -> a
forall a b. (Semigroup a, Integral b) => b -> a -> a
stimes b
n a
a))
stimes b
_ Result a
_ = Maybe a -> Result a
forall a. Maybe a -> Result a
Result Maybe a
forall a. Maybe a
Nothing
#endif
instance Monoid a => Monoid (Result a) where
{-# INLINABLE mempty #-}
mempty :: Result a
mempty = Maybe a -> Result a
forall a. Maybe a -> Result a
Result (a -> Maybe a
forall a. a -> Maybe a
Just a
forall a. Monoid a => a
mempty)
#if !(MIN_VERSION_base(4,11,0))
(Result (Just a)) `mappend` (Result (Just b)) = Result (Just (a `mappend` b))
_ `mappend` _ = Result Nothing
#endif
result :: b -> (a -> b) -> Result a -> b
{-# INLINE result #-}
result :: b -> (a -> b) -> Result a -> b
result b
n a -> b
j (Result Maybe a
m) = b -> (a -> b) -> Maybe a -> b
forall b a. b -> (a -> b) -> Maybe a -> b
maybe b
n a -> b
j Maybe a
m