{-# LANGUAGE Safe #-}
module Data.Functor.Classes (
Eq1(..), eq1,
Ord1(..), compare1,
Read1(..), readsPrec1, readPrec1,
liftReadListDefault, liftReadListPrecDefault,
Show1(..), showsPrec1,
Eq2(..), eq2,
Ord2(..), compare2,
Read2(..), readsPrec2, readPrec2,
liftReadList2Default, liftReadListPrec2Default,
Show2(..), showsPrec2,
readsData, readData,
readsUnaryWith, readUnaryWith,
readsBinaryWith, readBinaryWith,
showsUnaryWith,
showsBinaryWith,
readsUnary,
readsUnary1,
readsBinary1,
showsUnary,
showsUnary1,
showsBinary1,
) where
import Control.Applicative (Alternative((<|>)), Const(Const))
import Data.Functor.Identity (Identity(Identity))
import Data.Proxy (Proxy(Proxy))
import Data.List.NonEmpty (NonEmpty(..))
import Data.Ord (Down(Down))
import GHC.Read (expectP, list, paren)
import Text.ParserCombinators.ReadPrec (ReadPrec, readPrec_to_S, readS_to_Prec)
import Text.Read (Read(..), parens, prec, step)
import Text.Read.Lex (Lexeme(..))
import Text.Show (showListWith)
class Eq1 f where
liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool
eq1 :: (Eq1 f, Eq a) => f a -> f a -> Bool
eq1 :: f a -> f a -> Bool
eq1 = (a -> a -> Bool) -> f a -> f a -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(==)
class (Eq1 f) => Ord1 f where
liftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering
compare1 :: (Ord1 f, Ord a) => f a -> f a -> Ordering
compare1 :: f a -> f a -> Ordering
compare1 = (a -> a -> Ordering) -> f a -> f a -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> a -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
class Read1 f where
{-# MINIMAL liftReadsPrec | liftReadPrec #-}
liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
liftReadsPrec rp :: Int -> ReadS a
rp rl :: ReadS [a]
rl = ReadPrec (f a) -> Int -> ReadS (f a)
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S (ReadPrec (f a) -> Int -> ReadS (f a))
-> ReadPrec (f a) -> Int -> ReadS (f a)
forall a b. (a -> b) -> a -> b
$
ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
liftReadPrec ((Int -> ReadS a) -> ReadPrec a
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS a
rp) ((Int -> ReadS [a]) -> ReadPrec [a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [a] -> Int -> ReadS [a]
forall a b. a -> b -> a
const ReadS [a]
rl))
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadList rp :: Int -> ReadS a
rp rl :: ReadS [a]
rl = ReadPrec [f a] -> Int -> ReadS [f a]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S
(ReadPrec (f a) -> ReadPrec [f a]
forall a. ReadPrec a -> ReadPrec [a]
list (ReadPrec (f a) -> ReadPrec [f a])
-> ReadPrec (f a) -> ReadPrec [f a]
forall a b. (a -> b) -> a -> b
$ ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
liftReadPrec ((Int -> ReadS a) -> ReadPrec a
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS a
rp) ((Int -> ReadS [a]) -> ReadPrec [a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [a] -> Int -> ReadS [a]
forall a b. a -> b -> a
const ReadS [a]
rl))) 0
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
liftReadPrec rp :: ReadPrec a
rp rl :: ReadPrec [a]
rl = (Int -> ReadS (f a)) -> ReadPrec (f a)
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec ((Int -> ReadS (f a)) -> ReadPrec (f a))
-> (Int -> ReadS (f a)) -> ReadPrec (f a)
forall a b. (a -> b) -> a -> b
$
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
liftReadsPrec (ReadPrec a -> Int -> ReadS a
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec a
rp) (ReadPrec [a] -> Int -> ReadS [a]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec [a]
rl 0)
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrec rp :: ReadPrec a
rp rl :: ReadPrec [a]
rl = (Int -> ReadS [f a]) -> ReadPrec [f a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec ((Int -> ReadS [f a]) -> ReadPrec [f a])
-> (Int -> ReadS [f a]) -> ReadPrec [f a]
forall a b. (a -> b) -> a -> b
$ \_ ->
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadList (ReadPrec a -> Int -> ReadS a
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec a
rp) (ReadPrec [a] -> Int -> ReadS [a]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec [a]
rl 0)
readsPrec1 :: (Read1 f, Read a) => Int -> ReadS (f a)
readsPrec1 :: Int -> ReadS (f a)
readsPrec1 = (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
liftReadsPrec Int -> ReadS a
forall a. Read a => Int -> ReadS a
readsPrec ReadS [a]
forall a. Read a => ReadS [a]
readList
readPrec1 :: (Read1 f, Read a) => ReadPrec (f a)
readPrec1 :: ReadPrec (f a)
readPrec1 = ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
liftReadPrec ReadPrec a
forall a. Read a => ReadPrec a
readPrec ReadPrec [a]
forall a. Read a => ReadPrec [a]
readListPrec
liftReadListDefault :: Read1 f => (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault :: (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault rp :: Int -> ReadS a
rp rl :: ReadS [a]
rl = ReadPrec [f a] -> Int -> ReadS [f a]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S
(ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrec ((Int -> ReadS a) -> ReadPrec a
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS a
rp) ((Int -> ReadS [a]) -> ReadPrec [a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [a] -> Int -> ReadS [a]
forall a b. a -> b -> a
const ReadS [a]
rl))) 0
liftReadListPrecDefault :: Read1 f => ReadPrec a -> ReadPrec [a]
-> ReadPrec [f a]
liftReadListPrecDefault :: ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault rp :: ReadPrec a
rp rl :: ReadPrec [a]
rl = ReadPrec (f a) -> ReadPrec [f a]
forall a. ReadPrec a -> ReadPrec [a]
list (ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
liftReadPrec ReadPrec a
rp ReadPrec [a]
rl)
class Show1 f where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
Int -> f a -> ShowS
liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
[f a] -> ShowS
liftShowList sp :: Int -> a -> ShowS
sp sl :: [a] -> ShowS
sl = (f a -> ShowS) -> [f a] -> ShowS
forall a. (a -> ShowS) -> [a] -> ShowS
showListWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl 0)
showsPrec1 :: (Show1 f, Show a) => Int -> f a -> ShowS
showsPrec1 :: Int -> f a -> ShowS
showsPrec1 = (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList
class Eq2 f where
liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
eq2 :: (Eq2 f, Eq a, Eq b) => f a b -> f a b -> Bool
eq2 :: f a b -> f a b -> Bool
eq2 = (a -> a -> Bool) -> (b -> b -> Bool) -> f a b -> f a b -> Bool
forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(==) b -> b -> Bool
forall a. Eq a => a -> a -> Bool
(==)
class (Eq2 f) => Ord2 f where
liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) ->
f a c -> f b d -> Ordering
compare2 :: (Ord2 f, Ord a, Ord b) => f a b -> f a b -> Ordering
compare2 :: f a b -> f a b -> Ordering
compare2 = (a -> a -> Ordering)
-> (b -> b -> Ordering) -> f a b -> f a b -> Ordering
forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 a -> a -> Ordering
forall a. Ord a => a -> a -> Ordering
compare b -> b -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
class Read2 f where
{-# MINIMAL liftReadsPrec2 | liftReadPrec2 #-}
liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] ->
(Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (f a b)
liftReadsPrec2 rp1 :: Int -> ReadS a
rp1 rl1 :: ReadS [a]
rl1 rp2 :: Int -> ReadS b
rp2 rl2 :: ReadS [b]
rl2 = ReadPrec (f a b) -> Int -> ReadS (f a b)
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S (ReadPrec (f a b) -> Int -> ReadS (f a b))
-> ReadPrec (f a b) -> Int -> ReadS (f a b)
forall a b. (a -> b) -> a -> b
$
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ((Int -> ReadS a) -> ReadPrec a
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS a
rp1) ((Int -> ReadS [a]) -> ReadPrec [a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [a] -> Int -> ReadS [a]
forall a b. a -> b -> a
const ReadS [a]
rl1))
((Int -> ReadS b) -> ReadPrec b
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS b
rp2) ((Int -> ReadS [b]) -> ReadPrec [b]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [b] -> Int -> ReadS [b]
forall a b. a -> b -> a
const ReadS [b]
rl2))
liftReadList2 :: (Int -> ReadS a) -> ReadS [a] ->
(Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
liftReadList2 rp1 :: Int -> ReadS a
rp1 rl1 :: ReadS [a]
rl1 rp2 :: Int -> ReadS b
rp2 rl2 :: ReadS [b]
rl2 = ReadPrec [f a b] -> Int -> ReadS [f a b]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S
(ReadPrec (f a b) -> ReadPrec [f a b]
forall a. ReadPrec a -> ReadPrec [a]
list (ReadPrec (f a b) -> ReadPrec [f a b])
-> ReadPrec (f a b) -> ReadPrec [f a b]
forall a b. (a -> b) -> a -> b
$ ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ((Int -> ReadS a) -> ReadPrec a
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS a
rp1) ((Int -> ReadS [a]) -> ReadPrec [a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [a] -> Int -> ReadS [a]
forall a b. a -> b -> a
const ReadS [a]
rl1))
((Int -> ReadS b) -> ReadPrec b
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS b
rp2) ((Int -> ReadS [b]) -> ReadPrec [b]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [b] -> Int -> ReadS [b]
forall a b. a -> b -> a
const ReadS [b]
rl2))) 0
liftReadPrec2 :: ReadPrec a -> ReadPrec [a] ->
ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 rp1 :: ReadPrec a
rp1 rl1 :: ReadPrec [a]
rl1 rp2 :: ReadPrec b
rp2 rl2 :: ReadPrec [b]
rl2 = (Int -> ReadS (f a b)) -> ReadPrec (f a b)
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec ((Int -> ReadS (f a b)) -> ReadPrec (f a b))
-> (Int -> ReadS (f a b)) -> ReadPrec (f a b)
forall a b. (a -> b) -> a -> b
$
(Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (f a b)
forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (f a b)
liftReadsPrec2 (ReadPrec a -> Int -> ReadS a
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec a
rp1) (ReadPrec [a] -> Int -> ReadS [a]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec [a]
rl1 0)
(ReadPrec b -> Int -> ReadS b
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec b
rp2) (ReadPrec [b] -> Int -> ReadS [b]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec [b]
rl2 0)
liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] ->
ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2 rp1 :: ReadPrec a
rp1 rl1 :: ReadPrec [a]
rl1 rp2 :: ReadPrec b
rp2 rl2 :: ReadPrec [b]
rl2 = (Int -> ReadS [f a b]) -> ReadPrec [f a b]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec ((Int -> ReadS [f a b]) -> ReadPrec [f a b])
-> (Int -> ReadS [f a b]) -> ReadPrec [f a b]
forall a b. (a -> b) -> a -> b
$ \_ ->
(Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
liftReadList2 (ReadPrec a -> Int -> ReadS a
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec a
rp1) (ReadPrec [a] -> Int -> ReadS [a]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec [a]
rl1 0)
(ReadPrec b -> Int -> ReadS b
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec b
rp2) (ReadPrec [b] -> Int -> ReadS [b]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S ReadPrec [b]
rl2 0)
readsPrec2 :: (Read2 f, Read a, Read b) => Int -> ReadS (f a b)
readsPrec2 :: Int -> ReadS (f a b)
readsPrec2 = (Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (f a b)
forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a]
-> (Int -> ReadS b)
-> ReadS [b]
-> Int
-> ReadS (f a b)
liftReadsPrec2 Int -> ReadS a
forall a. Read a => Int -> ReadS a
readsPrec ReadS [a]
forall a. Read a => ReadS [a]
readList Int -> ReadS b
forall a. Read a => Int -> ReadS a
readsPrec ReadS [b]
forall a. Read a => ReadS [a]
readList
readPrec2 :: (Read2 f, Read a, Read b) => ReadPrec (f a b)
readPrec2 :: ReadPrec (f a b)
readPrec2 = ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ReadPrec a
forall a. Read a => ReadPrec a
readPrec ReadPrec [a]
forall a. Read a => ReadPrec [a]
readListPrec ReadPrec b
forall a. Read a => ReadPrec a
readPrec ReadPrec [b]
forall a. Read a => ReadPrec [a]
readListPrec
liftReadList2Default :: Read2 f => (Int -> ReadS a) -> ReadS [a] ->
(Int -> ReadS b) -> ReadS [b] ->ReadS [f a b]
liftReadList2Default :: (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
liftReadList2Default rp1 :: Int -> ReadS a
rp1 rl1 :: ReadS [a]
rl1 rp2 :: Int -> ReadS b
rp2 rl2 :: ReadS [b]
rl2 = ReadPrec [f a b] -> Int -> ReadS [f a b]
forall a. ReadPrec a -> Int -> ReadS a
readPrec_to_S
(ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2 ((Int -> ReadS a) -> ReadPrec a
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS a
rp1) ((Int -> ReadS [a]) -> ReadPrec [a]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [a] -> Int -> ReadS [a]
forall a b. a -> b -> a
const ReadS [a]
rl1))
((Int -> ReadS b) -> ReadPrec b
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec Int -> ReadS b
rp2) ((Int -> ReadS [b]) -> ReadPrec [b]
forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec (ReadS [b] -> Int -> ReadS [b]
forall a b. a -> b -> a
const ReadS [b]
rl2))) 0
liftReadListPrec2Default :: Read2 f => ReadPrec a -> ReadPrec [a] ->
ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2Default :: ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2Default rp1 :: ReadPrec a
rp1 rl1 :: ReadPrec [a]
rl1 rp2 :: ReadPrec b
rp2 rl2 :: ReadPrec [b]
rl2 = ReadPrec (f a b) -> ReadPrec [f a b]
forall a. ReadPrec a -> ReadPrec [a]
list (ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ReadPrec a
rp1 ReadPrec [a]
rl1 ReadPrec b
rp2 ReadPrec [b]
rl2)
class Show2 f where
liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
(Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> f a b -> ShowS
liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) ->
(Int -> b -> ShowS) -> ([b] -> ShowS) -> [f a b] -> ShowS
liftShowList2 sp1 :: Int -> a -> ShowS
sp1 sl1 :: [a] -> ShowS
sl1 sp2 :: Int -> b -> ShowS
sp2 sl2 :: [b] -> ShowS
sl2 =
(f a b -> ShowS) -> [f a b] -> ShowS
forall a. (a -> ShowS) -> [a] -> ShowS
showListWith ((Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
sp1 [a] -> ShowS
sl1 Int -> b -> ShowS
sp2 [b] -> ShowS
sl2 0)
showsPrec2 :: (Show2 f, Show a, Show b) => Int -> f a b -> ShowS
showsPrec2 :: Int -> f a b -> ShowS
showsPrec2 = (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList Int -> b -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [b] -> ShowS
forall a. Show a => [a] -> ShowS
showList
instance Eq1 Maybe where
liftEq :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool
liftEq _ Nothing Nothing = Bool
True
liftEq _ Nothing (Just _) = Bool
False
liftEq _ (Just _) Nothing = Bool
False
liftEq eq :: a -> b -> Bool
eq (Just x :: a
x) (Just y :: b
y) = a -> b -> Bool
eq a
x b
y
instance Ord1 Maybe where
liftCompare :: (a -> b -> Ordering) -> Maybe a -> Maybe b -> Ordering
liftCompare _ Nothing Nothing = Ordering
EQ
liftCompare _ Nothing (Just _) = Ordering
LT
liftCompare _ (Just _) Nothing = Ordering
GT
liftCompare comp :: a -> b -> Ordering
comp (Just x :: a
x) (Just y :: b
y) = a -> b -> Ordering
comp a
x b
y
instance Read1 Maybe where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Maybe a)
liftReadPrec rp :: ReadPrec a
rp _ =
ReadPrec (Maybe a) -> ReadPrec (Maybe a)
forall a. ReadPrec a -> ReadPrec a
parens (Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "Nothing") ReadPrec () -> ReadPrec (Maybe a) -> ReadPrec (Maybe a)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Maybe a -> ReadPrec (Maybe a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe a
forall a. Maybe a
Nothing)
ReadPrec (Maybe a) -> ReadPrec (Maybe a) -> ReadPrec (Maybe a)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
ReadPrec (Maybe a) -> ReadPrec (Maybe a)
forall a. ReadPrec a -> ReadPrec a
readData (ReadPrec a -> String -> (a -> Maybe a) -> ReadPrec (Maybe a)
forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith ReadPrec a
rp "Just" a -> Maybe a
forall a. a -> Maybe a
Just)
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Maybe a]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [Maybe a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance Show1 Maybe where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Maybe a -> ShowS
liftShowsPrec _ _ _ Nothing = String -> ShowS
showString "Nothing"
liftShowsPrec sp :: Int -> a -> ShowS
sp _ d :: Int
d (Just x :: a
x) = (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> a -> ShowS
sp "Just" Int
d a
x
instance Eq1 [] where
liftEq :: (a -> b -> Bool) -> [a] -> [b] -> Bool
liftEq _ [] [] = Bool
True
liftEq _ [] (_:_) = Bool
False
liftEq _ (_:_) [] = Bool
False
liftEq eq :: a -> b -> Bool
eq (x :: a
x:xs :: [a]
xs) (y :: b
y:ys :: [b]
ys) = a -> b -> Bool
eq a
x b
y Bool -> Bool -> Bool
&& (a -> b -> Bool) -> [a] -> [b] -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> b -> Bool
eq [a]
xs [b]
ys
instance Ord1 [] where
liftCompare :: (a -> b -> Ordering) -> [a] -> [b] -> Ordering
liftCompare _ [] [] = Ordering
EQ
liftCompare _ [] (_:_) = Ordering
LT
liftCompare _ (_:_) [] = Ordering
GT
liftCompare comp :: a -> b -> Ordering
comp (x :: a
x:xs :: [a]
xs) (y :: b
y:ys :: [b]
ys) = a -> b -> Ordering
comp a
x b
y Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` (a -> b -> Ordering) -> [a] -> [b] -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> b -> Ordering
comp [a]
xs [b]
ys
instance Read1 [] where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [a]
liftReadPrec _ rl :: ReadPrec [a]
rl = ReadPrec [a]
rl
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [[a]]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [[a]]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [[a]]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [[a]]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance Show1 [] where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> [a] -> ShowS
liftShowsPrec _ sl :: [a] -> ShowS
sl _ = [a] -> ShowS
sl
instance Eq1 NonEmpty where
liftEq :: (a -> b -> Bool) -> NonEmpty a -> NonEmpty b -> Bool
liftEq eq :: a -> b -> Bool
eq (a :: a
a :| as :: [a]
as) (b :: b
b :| bs :: [b]
bs) = a -> b -> Bool
eq a
a b
b Bool -> Bool -> Bool
&& (a -> b -> Bool) -> [a] -> [b] -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> b -> Bool
eq [a]
as [b]
bs
instance Ord1 NonEmpty where
liftCompare :: (a -> b -> Ordering) -> NonEmpty a -> NonEmpty b -> Ordering
liftCompare cmp :: a -> b -> Ordering
cmp (a :: a
a :| as :: [a]
as) (b :: b
b :| bs :: [b]
bs) = a -> b -> Ordering
cmp a
a b
b Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` (a -> b -> Ordering) -> [a] -> [b] -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> b -> Ordering
cmp [a]
as [b]
bs
instance Read1 NonEmpty where
liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmpty a)
liftReadsPrec rdP :: Int -> ReadS a
rdP rdL :: ReadS [a]
rdL p :: Int
p s :: String
s = Bool -> ReadS (NonEmpty a) -> ReadS (NonEmpty a)
forall a. Bool -> ReadS a -> ReadS a
readParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 5) (\s' :: String
s' -> do
(a :: a
a, s'' :: String
s'') <- Int -> ReadS a
rdP 6 String
s'
(":|", s''' :: String
s''') <- ReadS String
lex String
s''
(as :: [a]
as, s'''' :: String
s'''') <- ReadS [a]
rdL String
s'''
(NonEmpty a, String) -> [(NonEmpty a, String)]
forall (m :: * -> *) a. Monad m => a -> m a
return (a
a a -> [a] -> NonEmpty a
forall a. a -> [a] -> NonEmpty a
:| [a]
as, String
s'''')) String
s
instance Show1 NonEmpty where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonEmpty a -> ShowS
liftShowsPrec shwP :: Int -> a -> ShowS
shwP shwL :: [a] -> ShowS
shwL p :: Int
p (a :: a
a :| as :: [a]
as) = Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 5) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
Int -> a -> ShowS
shwP 6 a
a ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ShowS
showString " :| " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> ShowS
shwL [a]
as
instance Eq2 (,) where
liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> (a, c) -> (b, d) -> Bool
liftEq2 e1 :: a -> b -> Bool
e1 e2 :: c -> d -> Bool
e2 (x1 :: a
x1, y1 :: c
y1) (x2 :: b
x2, y2 :: d
y2) = a -> b -> Bool
e1 a
x1 b
x2 Bool -> Bool -> Bool
&& c -> d -> Bool
e2 c
y1 d
y2
instance Ord2 (,) where
liftCompare2 :: (a -> b -> Ordering)
-> (c -> d -> Ordering) -> (a, c) -> (b, d) -> Ordering
liftCompare2 comp1 :: a -> b -> Ordering
comp1 comp2 :: c -> d -> Ordering
comp2 (x1 :: a
x1, y1 :: c
y1) (x2 :: b
x2, y2 :: d
y2) =
a -> b -> Ordering
comp1 a
x1 b
x2 Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` c -> d -> Ordering
comp2 c
y1 d
y2
instance Read2 (,) where
liftReadPrec2 :: ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (a, b)
liftReadPrec2 rp1 :: ReadPrec a
rp1 _ rp2 :: ReadPrec b
rp2 _ = ReadPrec (a, b) -> ReadPrec (a, b)
forall a. ReadPrec a -> ReadPrec a
parens (ReadPrec (a, b) -> ReadPrec (a, b))
-> ReadPrec (a, b) -> ReadPrec (a, b)
forall a b. (a -> b) -> a -> b
$ ReadPrec (a, b) -> ReadPrec (a, b)
forall a. ReadPrec a -> ReadPrec a
paren (ReadPrec (a, b) -> ReadPrec (a, b))
-> ReadPrec (a, b) -> ReadPrec (a, b)
forall a b. (a -> b) -> a -> b
$ do
a
x <- ReadPrec a
rp1
Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Punc ",")
b
y <- ReadPrec b
rp2
(a, b) -> ReadPrec (a, b)
forall (m :: * -> *) a. Monad m => a -> m a
return (a
x,b
y)
liftReadListPrec2 :: ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [(a, b)]
liftReadListPrec2 = ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [(a, b)]
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2Default
liftReadList2 :: (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [(a, b)]
liftReadList2 = (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [(a, b)]
forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
liftReadList2Default
instance Show2 (,) where
liftShowsPrec2 :: (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> (a, b)
-> ShowS
liftShowsPrec2 sp1 :: Int -> a -> ShowS
sp1 _ sp2 :: Int -> b -> ShowS
sp2 _ _ (x :: a
x, y :: b
y) =
Char -> ShowS
showChar '(' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
sp1 0 a
x ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ',' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> b -> ShowS
sp2 0 b
y ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ')'
instance (Eq a) => Eq1 ((,) a) where
liftEq :: (a -> b -> Bool) -> (a, a) -> (a, b) -> Bool
liftEq = (a -> a -> Bool) -> (a -> b -> Bool) -> (a, a) -> (a, b) -> Bool
forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(==)
instance (Ord a) => Ord1 ((,) a) where
liftCompare :: (a -> b -> Ordering) -> (a, a) -> (a, b) -> Ordering
liftCompare = (a -> a -> Ordering)
-> (a -> b -> Ordering) -> (a, a) -> (a, b) -> Ordering
forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 a -> a -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
instance (Read a) => Read1 ((,) a) where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (a, a)
liftReadPrec = ReadPrec a
-> ReadPrec [a] -> ReadPrec a -> ReadPrec [a] -> ReadPrec (a, a)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ReadPrec a
forall a. Read a => ReadPrec a
readPrec ReadPrec [a]
forall a. Read a => ReadPrec [a]
readListPrec
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [(a, a)]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [(a, a)]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [(a, a)]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [(a, a)]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance (Show a) => Show1 ((,) a) where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> (a, a) -> ShowS
liftShowsPrec = (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> Int
-> (a, a)
-> ShowS
forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList
instance Eq2 Either where
liftEq2 :: (a -> b -> Bool)
-> (c -> d -> Bool) -> Either a c -> Either b d -> Bool
liftEq2 e1 :: a -> b -> Bool
e1 _ (Left x :: a
x) (Left y :: b
y) = a -> b -> Bool
e1 a
x b
y
liftEq2 _ _ (Left _) (Right _) = Bool
False
liftEq2 _ _ (Right _) (Left _) = Bool
False
liftEq2 _ e2 :: c -> d -> Bool
e2 (Right x :: c
x) (Right y :: d
y) = c -> d -> Bool
e2 c
x d
y
instance Ord2 Either where
liftCompare2 :: (a -> b -> Ordering)
-> (c -> d -> Ordering) -> Either a c -> Either b d -> Ordering
liftCompare2 comp1 :: a -> b -> Ordering
comp1 _ (Left x :: a
x) (Left y :: b
y) = a -> b -> Ordering
comp1 a
x b
y
liftCompare2 _ _ (Left _) (Right _) = Ordering
LT
liftCompare2 _ _ (Right _) (Left _) = Ordering
GT
liftCompare2 _ comp2 :: c -> d -> Ordering
comp2 (Right x :: c
x) (Right y :: d
y) = c -> d -> Ordering
comp2 c
x d
y
instance Read2 Either where
liftReadPrec2 :: ReadPrec a
-> ReadPrec [a]
-> ReadPrec b
-> ReadPrec [b]
-> ReadPrec (Either a b)
liftReadPrec2 rp1 :: ReadPrec a
rp1 _ rp2 :: ReadPrec b
rp2 _ = ReadPrec (Either a b) -> ReadPrec (Either a b)
forall a. ReadPrec a -> ReadPrec a
readData (ReadPrec (Either a b) -> ReadPrec (Either a b))
-> ReadPrec (Either a b) -> ReadPrec (Either a b)
forall a b. (a -> b) -> a -> b
$
ReadPrec a -> String -> (a -> Either a b) -> ReadPrec (Either a b)
forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith ReadPrec a
rp1 "Left" a -> Either a b
forall a b. a -> Either a b
Left ReadPrec (Either a b)
-> ReadPrec (Either a b) -> ReadPrec (Either a b)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
ReadPrec b -> String -> (b -> Either a b) -> ReadPrec (Either a b)
forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith ReadPrec b
rp2 "Right" b -> Either a b
forall a b. b -> Either a b
Right
liftReadListPrec2 :: ReadPrec a
-> ReadPrec [a]
-> ReadPrec b
-> ReadPrec [b]
-> ReadPrec [Either a b]
liftReadListPrec2 = ReadPrec a
-> ReadPrec [a]
-> ReadPrec b
-> ReadPrec [b]
-> ReadPrec [Either a b]
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2Default
liftReadList2 :: (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Either a b]
liftReadList2 = (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Either a b]
forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
liftReadList2Default
instance Show2 Either where
liftShowsPrec2 :: (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> Either a b
-> ShowS
liftShowsPrec2 sp1 :: Int -> a -> ShowS
sp1 _ _ _ d :: Int
d (Left x :: a
x) = (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> a -> ShowS
sp1 "Left" Int
d a
x
liftShowsPrec2 _ _ sp2 :: Int -> b -> ShowS
sp2 _ d :: Int
d (Right x :: b
x) = (Int -> b -> ShowS) -> String -> Int -> b -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> b -> ShowS
sp2 "Right" Int
d b
x
instance (Eq a) => Eq1 (Either a) where
liftEq :: (a -> b -> Bool) -> Either a a -> Either a b -> Bool
liftEq = (a -> a -> Bool)
-> (a -> b -> Bool) -> Either a a -> Either a b -> Bool
forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(==)
instance (Ord a) => Ord1 (Either a) where
liftCompare :: (a -> b -> Ordering) -> Either a a -> Either a b -> Ordering
liftCompare = (a -> a -> Ordering)
-> (a -> b -> Ordering) -> Either a a -> Either a b -> Ordering
forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 a -> a -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
instance (Read a) => Read1 (Either a) where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Either a a)
liftReadPrec = ReadPrec a
-> ReadPrec [a]
-> ReadPrec a
-> ReadPrec [a]
-> ReadPrec (Either a a)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ReadPrec a
forall a. Read a => ReadPrec a
readPrec ReadPrec [a]
forall a. Read a => ReadPrec [a]
readListPrec
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Either a a]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [Either a a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Either a a]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [Either a a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance (Show a) => Show1 (Either a) where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Either a a -> ShowS
liftShowsPrec = (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> Int
-> Either a a
-> ShowS
forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList
instance Eq1 Identity where
liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool
liftEq eq :: a -> b -> Bool
eq (Identity x :: a
x) (Identity y :: b
y) = a -> b -> Bool
eq a
x b
y
instance Ord1 Identity where
liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering
liftCompare comp :: a -> b -> Ordering
comp (Identity x :: a
x) (Identity y :: b
y) = a -> b -> Ordering
comp a
x b
y
instance Read1 Identity where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Identity a)
liftReadPrec rp :: ReadPrec a
rp _ = ReadPrec (Identity a) -> ReadPrec (Identity a)
forall a. ReadPrec a -> ReadPrec a
readData (ReadPrec (Identity a) -> ReadPrec (Identity a))
-> ReadPrec (Identity a) -> ReadPrec (Identity a)
forall a b. (a -> b) -> a -> b
$
ReadPrec a -> String -> (a -> Identity a) -> ReadPrec (Identity a)
forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith ReadPrec a
rp "Identity" a -> Identity a
forall a. a -> Identity a
Identity
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [Identity a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [Identity a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance Show1 Identity where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS
liftShowsPrec sp :: Int -> a -> ShowS
sp _ d :: Int
d (Identity x :: a
x) = (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> a -> ShowS
sp "Identity" Int
d a
x
instance Eq2 Const where
liftEq2 :: (a -> b -> Bool)
-> (c -> d -> Bool) -> Const a c -> Const b d -> Bool
liftEq2 eq :: a -> b -> Bool
eq _ (Const x :: a
x) (Const y :: b
y) = a -> b -> Bool
eq a
x b
y
instance Ord2 Const where
liftCompare2 :: (a -> b -> Ordering)
-> (c -> d -> Ordering) -> Const a c -> Const b d -> Ordering
liftCompare2 comp :: a -> b -> Ordering
comp _ (Const x :: a
x) (Const y :: b
y) = a -> b -> Ordering
comp a
x b
y
instance Read2 Const where
liftReadPrec2 :: ReadPrec a
-> ReadPrec [a]
-> ReadPrec b
-> ReadPrec [b]
-> ReadPrec (Const a b)
liftReadPrec2 rp :: ReadPrec a
rp _ _ _ = ReadPrec (Const a b) -> ReadPrec (Const a b)
forall a. ReadPrec a -> ReadPrec a
readData (ReadPrec (Const a b) -> ReadPrec (Const a b))
-> ReadPrec (Const a b) -> ReadPrec (Const a b)
forall a b. (a -> b) -> a -> b
$
ReadPrec a -> String -> (a -> Const a b) -> ReadPrec (Const a b)
forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith ReadPrec a
rp "Const" a -> Const a b
forall k a (b :: k). a -> Const a b
Const
liftReadListPrec2 :: ReadPrec a
-> ReadPrec [a]
-> ReadPrec b
-> ReadPrec [b]
-> ReadPrec [Const a b]
liftReadListPrec2 = ReadPrec a
-> ReadPrec [a]
-> ReadPrec b
-> ReadPrec [b]
-> ReadPrec [Const a b]
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [f a b]
liftReadListPrec2Default
liftReadList2 :: (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b]
liftReadList2 = (Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b]
forall (f :: * -> * -> *) a b.
Read2 f =>
(Int -> ReadS a)
-> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [f a b]
liftReadList2Default
instance Show2 Const where
liftShowsPrec2 :: (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> Const a b
-> ShowS
liftShowsPrec2 sp :: Int -> a -> ShowS
sp _ _ _ d :: Int
d (Const x :: a
x) = (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> a -> ShowS
sp "Const" Int
d a
x
instance (Eq a) => Eq1 (Const a) where
liftEq :: (a -> b -> Bool) -> Const a a -> Const a b -> Bool
liftEq = (a -> a -> Bool)
-> (a -> b -> Bool) -> Const a a -> Const a b -> Bool
forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(==)
instance (Ord a) => Ord1 (Const a) where
liftCompare :: (a -> b -> Ordering) -> Const a a -> Const a b -> Ordering
liftCompare = (a -> a -> Ordering)
-> (a -> b -> Ordering) -> Const a a -> Const a b -> Ordering
forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 a -> a -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
instance (Read a) => Read1 (Const a) where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Const a a)
liftReadPrec = ReadPrec a
-> ReadPrec [a]
-> ReadPrec a
-> ReadPrec [a]
-> ReadPrec (Const a a)
forall (f :: * -> * -> *) a b.
Read2 f =>
ReadPrec a
-> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
liftReadPrec2 ReadPrec a
forall a. Read a => ReadPrec a
readPrec ReadPrec [a]
forall a. Read a => ReadPrec [a]
readListPrec
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Const a a]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [Const a a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Const a a]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [Const a a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance (Show a) => Show1 (Const a) where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Const a a -> ShowS
liftShowsPrec = (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> Int
-> Const a a
-> ShowS
forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList
instance Eq1 Proxy where
liftEq :: (a -> b -> Bool) -> Proxy a -> Proxy b -> Bool
liftEq _ _ _ = Bool
True
instance Ord1 Proxy where
liftCompare :: (a -> b -> Ordering) -> Proxy a -> Proxy b -> Ordering
liftCompare _ _ _ = Ordering
EQ
instance Show1 Proxy where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Proxy a -> ShowS
liftShowsPrec _ _ _ _ = String -> ShowS
showString "Proxy"
instance Read1 Proxy where
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Proxy a)
liftReadPrec _ _ = ReadPrec (Proxy a) -> ReadPrec (Proxy a)
forall a. ReadPrec a -> ReadPrec a
parens (Lexeme -> ReadPrec ()
expectP (String -> Lexeme
Ident "Proxy") ReadPrec () -> ReadPrec (Proxy a) -> ReadPrec (Proxy a)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Proxy a -> ReadPrec (Proxy a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Proxy a
forall k (t :: k). Proxy t
Proxy)
liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Proxy a]
liftReadListPrec = ReadPrec a -> ReadPrec [a] -> ReadPrec [Proxy a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
liftReadListPrecDefault
liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Proxy a]
liftReadList = (Int -> ReadS a) -> ReadS [a] -> ReadS [Proxy a]
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
liftReadListDefault
instance Eq1 Down where
liftEq :: (a -> b -> Bool) -> Down a -> Down b -> Bool
liftEq eq :: a -> b -> Bool
eq (Down x :: a
x) (Down y :: b
y) = a -> b -> Bool
eq a
x b
y
instance Ord1 Down where
liftCompare :: (a -> b -> Ordering) -> Down a -> Down b -> Ordering
liftCompare comp :: a -> b -> Ordering
comp (Down x :: a
x) (Down y :: b
y) = a -> b -> Ordering
comp a
x b
y
instance Read1 Down where
liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Down a)
liftReadsPrec rp :: Int -> ReadS a
rp _ = (String -> ReadS (Down a)) -> Int -> ReadS (Down a)
forall a. (String -> ReadS a) -> Int -> ReadS a
readsData ((String -> ReadS (Down a)) -> Int -> ReadS (Down a))
-> (String -> ReadS (Down a)) -> Int -> ReadS (Down a)
forall a b. (a -> b) -> a -> b
$
(Int -> ReadS a)
-> String -> (a -> Down a) -> String -> ReadS (Down a)
forall a t.
(Int -> ReadS a) -> String -> (a -> t) -> String -> ReadS t
readsUnaryWith Int -> ReadS a
rp "Down" a -> Down a
forall a. a -> Down a
Down
instance Show1 Down where
liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Down a -> ShowS
liftShowsPrec sp :: Int -> a -> ShowS
sp _ d :: Int
d (Down x :: a
x) = (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> a -> ShowS
sp "Down" Int
d a
x
readsData :: (String -> ReadS a) -> Int -> ReadS a
readsData :: (String -> ReadS a) -> Int -> ReadS a
readsData reader :: String -> ReadS a
reader d :: Int
d =
Bool -> ReadS a -> ReadS a
forall a. Bool -> ReadS a -> ReadS a
readParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 10) (ReadS a -> ReadS a) -> ReadS a -> ReadS a
forall a b. (a -> b) -> a -> b
$ \ r :: String
r -> [(a, String)
res | (kw :: String
kw,s :: String
s) <- ReadS String
lex String
r, (a, String)
res <- String -> ReadS a
reader String
kw String
s]
readData :: ReadPrec a -> ReadPrec a
readData :: ReadPrec a -> ReadPrec a
readData reader :: ReadPrec a
reader = ReadPrec a -> ReadPrec a
forall a. ReadPrec a -> ReadPrec a
parens (ReadPrec a -> ReadPrec a) -> ReadPrec a -> ReadPrec a
forall a b. (a -> b) -> a -> b
$ Int -> ReadPrec a -> ReadPrec a
forall a. Int -> ReadPrec a -> ReadPrec a
prec 10 ReadPrec a
reader
readsUnaryWith :: (Int -> ReadS a) -> String -> (a -> t) -> String -> ReadS t
readsUnaryWith :: (Int -> ReadS a) -> String -> (a -> t) -> String -> ReadS t
readsUnaryWith rp :: Int -> ReadS a
rp name :: String
name cons :: a -> t
cons kw :: String
kw s :: String
s =
[(a -> t
cons a
x,String
t) | String
kw String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
name, (x :: a
x,t :: String
t) <- Int -> ReadS a
rp 11 String
s]
readUnaryWith :: ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith :: ReadPrec a -> String -> (a -> t) -> ReadPrec t
readUnaryWith rp :: ReadPrec a
rp name :: String
name cons :: a -> t
cons = do
Lexeme -> ReadPrec ()
expectP (Lexeme -> ReadPrec ()) -> Lexeme -> ReadPrec ()
forall a b. (a -> b) -> a -> b
$ String -> Lexeme
Ident String
name
a
x <- ReadPrec a -> ReadPrec a
forall a. ReadPrec a -> ReadPrec a
step ReadPrec a
rp
t -> ReadPrec t
forall (m :: * -> *) a. Monad m => a -> m a
return (t -> ReadPrec t) -> t -> ReadPrec t
forall a b. (a -> b) -> a -> b
$ a -> t
cons a
x
readsBinaryWith :: (Int -> ReadS a) -> (Int -> ReadS b) ->
String -> (a -> b -> t) -> String -> ReadS t
readsBinaryWith :: (Int -> ReadS a)
-> (Int -> ReadS b) -> String -> (a -> b -> t) -> String -> ReadS t
readsBinaryWith rp1 :: Int -> ReadS a
rp1 rp2 :: Int -> ReadS b
rp2 name :: String
name cons :: a -> b -> t
cons kw :: String
kw s :: String
s =
[(a -> b -> t
cons a
x b
y,String
u) | String
kw String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
name, (x :: a
x,t :: String
t) <- Int -> ReadS a
rp1 11 String
s, (y :: b
y,u :: String
u) <- Int -> ReadS b
rp2 11 String
t]
readBinaryWith :: ReadPrec a -> ReadPrec b ->
String -> (a -> b -> t) -> ReadPrec t
readBinaryWith :: ReadPrec a -> ReadPrec b -> String -> (a -> b -> t) -> ReadPrec t
readBinaryWith rp1 :: ReadPrec a
rp1 rp2 :: ReadPrec b
rp2 name :: String
name cons :: a -> b -> t
cons = do
Lexeme -> ReadPrec ()
expectP (Lexeme -> ReadPrec ()) -> Lexeme -> ReadPrec ()
forall a b. (a -> b) -> a -> b
$ String -> Lexeme
Ident String
name
a
x <- ReadPrec a -> ReadPrec a
forall a. ReadPrec a -> ReadPrec a
step ReadPrec a
rp1
b
y <- ReadPrec b -> ReadPrec b
forall a. ReadPrec a -> ReadPrec a
step ReadPrec b
rp2
t -> ReadPrec t
forall (m :: * -> *) a. Monad m => a -> m a
return (t -> ReadPrec t) -> t -> ReadPrec t
forall a b. (a -> b) -> a -> b
$ a -> b -> t
cons a
x b
y
showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith sp :: Int -> a -> ShowS
sp name :: String
name d :: Int
d x :: a
x = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
name ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
sp 11 a
x
showsBinaryWith :: (Int -> a -> ShowS) -> (Int -> b -> ShowS) ->
String -> Int -> a -> b -> ShowS
showsBinaryWith :: (Int -> a -> ShowS)
-> (Int -> b -> ShowS) -> String -> Int -> a -> b -> ShowS
showsBinaryWith sp1 :: Int -> a -> ShowS
sp1 sp2 :: Int -> b -> ShowS
sp2 name :: String
name d :: Int
d x :: a
x y :: b
y = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
name ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
sp1 11 a
x ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> b -> ShowS
sp2 11 b
y
{-# DEPRECATED readsUnary "Use 'readsUnaryWith' to define 'liftReadsPrec'" #-}
readsUnary :: (Read a) => String -> (a -> t) -> String -> ReadS t
readsUnary :: String -> (a -> t) -> String -> ReadS t
readsUnary name :: String
name cons :: a -> t
cons kw :: String
kw s :: String
s =
[(a -> t
cons a
x,String
t) | String
kw String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
name, (x :: a
x,t :: String
t) <- Int -> ReadS a
forall a. Read a => Int -> ReadS a
readsPrec 11 String
s]
{-# DEPRECATED readsUnary1 "Use 'readsUnaryWith' to define 'liftReadsPrec'" #-}
readsUnary1 :: (Read1 f, Read a) => String -> (f a -> t) -> String -> ReadS t
readsUnary1 :: String -> (f a -> t) -> String -> ReadS t
readsUnary1 name :: String
name cons :: f a -> t
cons kw :: String
kw s :: String
s =
[(f a -> t
cons f a
x,String
t) | String
kw String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
name, (x :: f a
x,t :: String
t) <- Int -> ReadS (f a)
forall (f :: * -> *) a. (Read1 f, Read a) => Int -> ReadS (f a)
readsPrec1 11 String
s]
{-# DEPRECATED readsBinary1
"Use 'readsBinaryWith' to define 'liftReadsPrec'" #-}
readsBinary1 :: (Read1 f, Read1 g, Read a) =>
String -> (f a -> g a -> t) -> String -> ReadS t
readsBinary1 :: String -> (f a -> g a -> t) -> String -> ReadS t
readsBinary1 name :: String
name cons :: f a -> g a -> t
cons kw :: String
kw s :: String
s =
[(f a -> g a -> t
cons f a
x g a
y,String
u) | String
kw String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
name,
(x :: f a
x,t :: String
t) <- Int -> ReadS (f a)
forall (f :: * -> *) a. (Read1 f, Read a) => Int -> ReadS (f a)
readsPrec1 11 String
s, (y :: g a
y,u :: String
u) <- Int -> ReadS (g a)
forall (f :: * -> *) a. (Read1 f, Read a) => Int -> ReadS (f a)
readsPrec1 11 String
t]
{-# DEPRECATED showsUnary "Use 'showsUnaryWith' to define 'liftShowsPrec'" #-}
showsUnary :: (Show a) => String -> Int -> a -> ShowS
showsUnary :: String -> Int -> a -> ShowS
showsUnary name :: String
name d :: Int
d x :: a
x = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
name ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11 a
x
{-# DEPRECATED showsUnary1 "Use 'showsUnaryWith' to define 'liftShowsPrec'" #-}
showsUnary1 :: (Show1 f, Show a) => String -> Int -> f a -> ShowS
showsUnary1 :: String -> Int -> f a -> ShowS
showsUnary1 name :: String
name d :: Int
d x :: f a
x = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
name ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> f a -> ShowS
forall (f :: * -> *) a. (Show1 f, Show a) => Int -> f a -> ShowS
showsPrec1 11 f a
x
{-# DEPRECATED showsBinary1
"Use 'showsBinaryWith' to define 'liftShowsPrec'" #-}
showsBinary1 :: (Show1 f, Show1 g, Show a) =>
String -> Int -> f a -> g a -> ShowS
showsBinary1 :: String -> Int -> f a -> g a -> ShowS
showsBinary1 name :: String
name d :: Int
d x :: f a
x y :: g a
y = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
name ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> f a -> ShowS
forall (f :: * -> *) a. (Show1 f, Show a) => Int -> f a -> ShowS
showsPrec1 11 f a
x ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Char -> ShowS
showChar ' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> g a -> ShowS
forall (f :: * -> *) a. (Show1 f, Show a) => Int -> f a -> ShowS
showsPrec1 11 g a
y