    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE DeriveTraversable #-}

    -- | Base Functors for standard types not already expressed as a fixed point.
    module Data.Functor.Base
      ( ListF (..)
      , NonEmptyF(..)
      , TreeF (..), ForestF,
      ) where

    import GHC.Generics (Generic, Generic1)

    import Control.Applicative
    import Data.Monoid

    import Data.Functor.Classes
      ( Eq1(..), Ord1(..), Show1(..), Read1(..)
      , Eq2(..), Ord2(..), Show2(..), Read2(..)
      )

    import qualified Data.Foldable as F
    import qualified Data.Traversable as T

    import qualified Data.Bifunctor as Bi
    import qualified Data.Bifoldable as Bi
    import qualified Data.Bitraversable as Bi

    import Prelude hiding (head, tail)

    -------------------------------------------------------------------------------
    -- ListF
    -------------------------------------------------------------------------------

    -- | Base functor of @[]@.
    data ListF a b = Nil | Cons a b
      deriving (ListF a b -> ListF a b -> Bool
    (ListF a b -> ListF a b -> Bool)
    -> (ListF a b -> ListF a b -> Bool) -> Eq (ListF a b)
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    forall a b. (Eq a, Eq b) => ListF a b -> ListF a b -> Bool
    $c== :: forall a b. (Eq a, Eq b) => ListF a b -> ListF a b -> Bool
    == :: ListF a b -> ListF a b -> Bool
    $c/= :: forall a b. (Eq a, Eq b) => ListF a b -> ListF a b -> Bool
    /= :: ListF a b -> ListF a b -> Bool
    Eq,Eq (ListF a b)
    Eq (ListF a b) =>
    (ListF a b -> ListF a b -> Ordering)
    -> (ListF a b -> ListF a b -> Bool)
    -> (ListF a b -> ListF a b -> Bool)
    -> (ListF a b -> ListF a b -> Bool)
    -> (ListF a b -> ListF a b -> Bool)
    -> (ListF a b -> ListF a b -> ListF a b)
    -> (ListF a b -> ListF a b -> ListF a b)
    -> Ord (ListF a b)
    ListF a b -> ListF a b -> Bool
    ListF a b -> ListF a b -> Ordering
    ListF a b -> ListF a b -> ListF a b
    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 b. (Ord a, Ord b) => Eq (ListF a b)
    forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Bool
    forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Ordering
    forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> ListF a b
    $ccompare :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Ordering
    compare :: ListF a b -> ListF a b -> Ordering
    $c< :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Bool
    < :: ListF a b -> ListF a b -> Bool
    $c<= :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Bool
    <= :: ListF a b -> ListF a b -> Bool
    $c> :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Bool
    > :: ListF a b -> ListF a b -> Bool
    $c>= :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> Bool
    >= :: ListF a b -> ListF a b -> Bool
    $cmax :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> ListF a b
    max :: ListF a b -> ListF a b -> ListF a b
    $cmin :: forall a b. (Ord a, Ord b) => ListF a b -> ListF a b -> ListF a b
    min :: ListF a b -> ListF a b -> ListF a b
    Ord,Int -> ListF a b -> ShowS
    [ListF a b] -> ShowS
    ListF a b -> String
    (Int -> ListF a b -> ShowS)
    -> (ListF a b -> String)
    -> ([ListF a b] -> ShowS)
    -> Show (ListF a b)
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    forall a b. (Show a, Show b) => Int -> ListF a b -> ShowS
    forall a b. (Show a, Show b) => [ListF a b] -> ShowS
    forall a b. (Show a, Show b) => ListF a b -> String
    $cshowsPrec :: forall a b. (Show a, Show b) => Int -> ListF a b -> ShowS
    showsPrec :: Int -> ListF a b -> ShowS
    $cshow :: forall a b. (Show a, Show b) => ListF a b -> String
    show :: ListF a b -> String
    $cshowList :: forall a b. (Show a, Show b) => [ListF a b] -> ShowS
    showList :: [ListF a b] -> ShowS
    Show,ReadPrec [ListF a b]
    ReadPrec (ListF a b)
    Int -> ReadS (ListF a b)
    ReadS [ListF a b]
    (Int -> ReadS (ListF a b))
    -> ReadS [ListF a b]
    -> ReadPrec (ListF a b)
    -> ReadPrec [ListF a b]
    -> Read (ListF a b)
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    forall a b. (Read a, Read b) => ReadPrec [ListF a b]
    forall a b. (Read a, Read b) => ReadPrec (ListF a b)
    forall a b. (Read a, Read b) => Int -> ReadS (ListF a b)
    forall a b. (Read a, Read b) => ReadS [ListF a b]
    $creadsPrec :: forall a b. (Read a, Read b) => Int -> ReadS (ListF a b)
    readsPrec :: Int -> ReadS (ListF a b)
    $creadList :: forall a b. (Read a, Read b) => ReadS [ListF a b]
    readList :: ReadS [ListF a b]
    $creadPrec :: forall a b. (Read a, Read b) => ReadPrec (ListF a b)
    readPrec :: ReadPrec (ListF a b)
    $creadListPrec :: forall a b. (Read a, Read b) => ReadPrec [ListF a b]
    readListPrec :: ReadPrec [ListF a b]
    Read,(forall x. ListF a b -> Rep (ListF a b) x)
    -> (forall x. Rep (ListF a b) x -> ListF a b)
    -> Generic (ListF a b)
    forall x. Rep (ListF a b) x -> ListF a b
    forall x. ListF a b -> Rep (ListF a b) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall a b x. Rep (ListF a b) x -> ListF a b
    forall a b x. ListF a b -> Rep (ListF a b) x
    $cfrom :: forall a b x. ListF a b -> Rep (ListF a b) x
    from :: forall x. ListF a b -> Rep (ListF a b) x
    $cto :: forall a b x. Rep (ListF a b) x -> ListF a b
    to :: forall x. Rep (ListF a b) x -> ListF a b
    Generic,(forall a. ListF a a -> Rep1 (ListF a) a)
    -> (forall a. Rep1 (ListF a) a -> ListF a a) -> Generic1 (ListF a)
    forall a. Rep1 (ListF a) a -> ListF a a
    forall a. ListF a a -> Rep1 (ListF a) a
    forall a a. Rep1 (ListF a) a -> ListF a a
    forall a a. ListF a a -> Rep1 (ListF a) a
    forall k (f :: k -> *).
    (forall (a :: k). f a -> Rep1 f a)
    -> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
    $cfrom1 :: forall a a. ListF a a -> Rep1 (ListF a) a
    from1 :: forall a. ListF a a -> Rep1 (ListF a) a
    $cto1 :: forall a a. Rep1 (ListF a) a -> ListF a a
    to1 :: forall a. Rep1 (ListF a) a -> ListF a a
    Generic1,(forall a b. (a -> b) -> ListF a a -> ListF a b)
    -> (forall a b. a -> ListF a b -> ListF a a) -> Functor (ListF a)
    forall a b. a -> ListF a b -> ListF a a
    forall a b. (a -> b) -> ListF a a -> ListF a b
    forall a a b. a -> ListF a b -> ListF a a
    forall a a b. (a -> b) -> ListF a a -> ListF a b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall a a b. (a -> b) -> ListF a a -> ListF a b
    fmap :: forall a b. (a -> b) -> ListF a a -> ListF a b
    $c<$ :: forall a a b. a -> ListF a b -> ListF a a
    <$ :: forall a b. a -> ListF a b -> ListF a a
    Functor,(forall m. Monoid m => ListF a m -> m)
    -> (forall m a. Monoid m => (a -> m) -> ListF a a -> m)
    -> (forall m a. Monoid m => (a -> m) -> ListF a a -> m)
    -> (forall a b. (a -> b -> b) -> b -> ListF a a -> b)
    -> (forall a b. (a -> b -> b) -> b -> ListF a a -> b)
    -> (forall b a. (b -> a -> b) -> b -> ListF a a -> b)
    -> (forall b a. (b -> a -> b) -> b -> ListF a a -> b)
    -> (forall a. (a -> a -> a) -> ListF a a -> a)
    -> (forall a. (a -> a -> a) -> ListF a a -> a)
    -> (forall a. ListF a a -> [a])
    -> (forall a. ListF a a -> Bool)
    -> (forall a. ListF a a -> Int)
    -> (forall a. Eq a => a -> ListF a a -> Bool)
    -> (forall a. Ord a => ListF a a -> a)
    -> (forall a. Ord a => ListF a a -> a)
    -> (forall a. Num a => ListF a a -> a)
    -> (forall a. Num a => ListF a a -> a)
    -> Foldable (ListF a)
    forall a. Eq a => a -> ListF a a -> Bool
    forall a. Num a => ListF a a -> a
    forall a. Ord a => ListF a a -> a
    forall m. Monoid m => ListF a m -> m
    forall a. ListF a a -> Bool
    forall a. ListF a a -> Int
    forall a. ListF a a -> [a]
    forall a. (a -> a -> a) -> ListF a a -> a
    forall a a. Eq a => a -> ListF a a -> Bool
    forall a a. Num a => ListF a a -> a
    forall a a. Ord a => ListF a a -> a
    forall a m. Monoid m => ListF a m -> m
    forall m a. Monoid m => (a -> m) -> ListF a a -> m
    forall a a. ListF a a -> Bool
    forall a a. ListF a a -> Int
    forall a a. ListF a a -> [a]
    forall b a. (b -> a -> b) -> b -> ListF a a -> b
    forall a b. (a -> b -> b) -> b -> ListF a a -> b
    forall a a. (a -> a -> a) -> ListF a a -> a
    forall a m a. Monoid m => (a -> m) -> ListF a a -> m
    forall a b a. (b -> a -> b) -> b -> ListF a a -> b
    forall a a b. (a -> b -> b) -> b -> ListF a 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
    $cfold :: forall a m. Monoid m => ListF a m -> m
    fold :: forall m. Monoid m => ListF a m -> m
    $cfoldMap :: forall a m a. Monoid m => (a -> m) -> ListF a a -> m
    foldMap :: forall m a. Monoid m => (a -> m) -> ListF a a -> m
    $cfoldMap' :: forall a m a. Monoid m => (a -> m) -> ListF a a -> m
    foldMap' :: forall m a. Monoid m => (a -> m) -> ListF a a -> m
    $cfoldr :: forall a a b. (a -> b -> b) -> b -> ListF a a -> b
    foldr :: forall a b. (a -> b -> b) -> b -> ListF a a -> b
    $cfoldr' :: forall a a b. (a -> b -> b) -> b -> ListF a a -> b
    foldr' :: forall a b. (a -> b -> b) -> b -> ListF a a -> b
    $cfoldl :: forall a b a. (b -> a -> b) -> b -> ListF a a -> b
    foldl :: forall b a. (b -> a -> b) -> b -> ListF a a -> b
    $cfoldl' :: forall a b a. (b -> a -> b) -> b -> ListF a a -> b
    foldl' :: forall b a. (b -> a -> b) -> b -> ListF a a -> b
    $cfoldr1 :: forall a a. (a -> a -> a) -> ListF a a -> a
    foldr1 :: forall a. (a -> a -> a) -> ListF a a -> a
    $cfoldl1 :: forall a a. (a -> a -> a) -> ListF a a -> a
    foldl1 :: forall a. (a -> a -> a) -> ListF a a -> a
    $ctoList :: forall a a. ListF a a -> [a]
    toList :: forall a. ListF a a -> [a]
    $cnull :: forall a a. ListF a a -> Bool
    null :: forall a. ListF a a -> Bool
    $clength :: forall a a. ListF a a -> Int
    length :: forall a. ListF a a -> Int
    $celem :: forall a a. Eq a => a -> ListF a a -> Bool
    elem :: forall a. Eq a => a -> ListF a a -> Bool
    $cmaximum :: forall a a. Ord a => ListF a a -> a
    maximum :: forall a. Ord a => ListF a a -> a
    $cminimum :: forall a a. Ord a => ListF a a -> a
    minimum :: forall a. Ord a => ListF a a -> a
    $csum :: forall a a. Num a => ListF a a -> a
    sum :: forall a. Num a => ListF a a -> a
    $cproduct :: forall a a. Num a => ListF a a -> a
    product :: forall a. Num a => ListF a a -> a
    F.Foldable,Functor (ListF a)
    Foldable (ListF a)
    (Functor (ListF a), Foldable (ListF a)) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> ListF a a -> f (ListF a b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        ListF a (f a) -> f (ListF a a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> ListF a a -> m (ListF a b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        ListF a (m a) -> m (ListF a a))
    -> Traversable (ListF a)
    forall a. Functor (ListF a)
    forall a. Foldable (ListF a)
    forall a (m :: * -> *) a. Monad m => ListF a (m a) -> m (ListF a a)
    forall a (f :: * -> *) a.
    Applicative f =>
    ListF a (f a) -> f (ListF a a)
    forall a (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ListF a a -> m (ListF a b)
    forall a (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ListF a a -> f (ListF a 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 => ListF a (m a) -> m (ListF a a)
    forall (f :: * -> *) a.
    Applicative f =>
    ListF a (f a) -> f (ListF a a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ListF a a -> m (ListF a b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ListF a a -> f (ListF a b)
    $ctraverse :: forall a (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ListF a a -> f (ListF a b)
    traverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ListF a a -> f (ListF a b)
    $csequenceA :: forall a (f :: * -> *) a.
    Applicative f =>
    ListF a (f a) -> f (ListF a a)
    sequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    ListF a (f a) -> f (ListF a a)
    $cmapM :: forall a (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ListF a a -> m (ListF a b)
    mapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ListF a a -> m (ListF a b)
    $csequence :: forall a (m :: * -> *) a. Monad m => ListF a (m a) -> m (ListF a a)
    sequence :: forall (m :: * -> *) a. Monad m => ListF a (m a) -> m (ListF a a)
    T.Traversable)

    instance Eq2 ListF where
      liftEq2 :: forall a b c d.
    (a -> b -> Bool)
    -> (c -> d -> Bool) -> ListF a c -> ListF b d -> Bool
    liftEq2 a -> b -> Bool
    _ c -> d -> Bool
    _ ListF a c
    Nil        ListF b d
    Nil          = Bool
    True
      liftEq2 a -> b -> Bool
    f c -> d -> Bool
    g (Cons a
    a c
    b) (Cons b
    a' d
    b') = a -> b -> Bool
    f a
    a b
    a' Bool -> Bool -> Bool
    && c -> d -> Bool
    g c
    b d
    b'
      liftEq2 a -> b -> Bool
    _ c -> d -> Bool
    _ ListF a c
    _          ListF b d
    _            = Bool
    False

    instance Eq a => Eq1 (ListF a) where
      liftEq :: forall a b. (a -> b -> Bool) -> ListF a a -> ListF a b -> Bool
    liftEq = (a -> a -> Bool)
    -> (a -> b -> Bool) -> ListF a a -> ListF a b -> Bool
    forall a b c d.
    (a -> b -> Bool)
    -> (c -> d -> Bool) -> ListF a c -> ListF b d -> 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 Ord2 ListF where
      liftCompare2 :: forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering) -> ListF a c -> ListF b d -> Ordering
    liftCompare2 a -> b -> Ordering
    _ c -> d -> Ordering
    _ ListF a c
    Nil        ListF b d
    Nil          = Ordering
    EQ
      liftCompare2 a -> b -> Ordering
    _ c -> d -> Ordering
    _ ListF a c
    Nil        ListF b d
    _            = Ordering
    LT
      liftCompare2 a -> b -> Ordering
    _ c -> d -> Ordering
    _ ListF a c
    _          ListF b d
    Nil          = Ordering
    GT
      liftCompare2 a -> b -> Ordering
    f c -> d -> Ordering
    g (Cons a
    a c
    b) (Cons b
    a' d
    b') = a -> b -> Ordering
    f a
    a b
    a' Ordering -> Ordering -> Ordering
    forall a. Monoid a => a -> a -> a
    `mappend` c -> d -> Ordering
    g c
    b d
    b'

    instance Ord a => Ord1 (ListF a) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> ListF a a -> ListF a b -> Ordering
    liftCompare = (a -> a -> Ordering)
    -> (a -> b -> Ordering) -> ListF a a -> ListF a b -> Ordering
    forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering) -> ListF a c -> ListF b d -> 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 Show a => Show1 (ListF a) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ListF a a -> ShowS
    liftShowsPrec = (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> Int
    -> ListF a a
    -> ShowS
    forall a b.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> b -> ShowS)
    -> ([b] -> ShowS)
    -> Int
    -> ListF 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

    instance Show2 ListF where
      liftShowsPrec2 :: forall a b.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> b -> ShowS)
    -> ([b] -> ShowS)
    -> Int
    -> ListF a b
    -> ShowS
    liftShowsPrec2 Int -> a -> ShowS
    _  [a] -> ShowS
    _ Int -> b -> ShowS
    _  [b] -> ShowS
    _ Int
    _ ListF a b
    Nil        = String -> ShowS
    showString String
    "Nil"
      liftShowsPrec2 Int -> a -> ShowS
    sa [a] -> ShowS
    _ Int -> b -> ShowS
    sb [b] -> ShowS
    _ Int
    d (Cons a
    a b
    b) = 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
    "Cons "
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> a -> ShowS
    sa Int
    11 a
    a
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    " "
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> b -> ShowS
    sb Int
    11 b
    b

    instance Read2 ListF where
      liftReadsPrec2 :: forall a b.
    (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS b)
    -> ReadS [b]
    -> Int
    -> ReadS (ListF a b)
    liftReadsPrec2 Int -> ReadS a
    ra ReadS [a]
    _ Int -> ReadS b
    rb ReadS [b]
    _ Int
    d = Bool -> ReadS (ListF a b) -> ReadS (ListF a b)
    forall a. Bool -> ReadS a -> ReadS a
    readParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10) (ReadS (ListF a b) -> ReadS (ListF a b))
    -> ReadS (ListF a b) -> ReadS (ListF a b)
    forall a b. (a -> b) -> a -> b
    $ \String
    s -> ReadS (ListF a b)
    forall {a} {b}. String -> [(ListF a b, String)]
    nil String
    s [(ListF a b, String)]
    -> [(ListF a b, String)] -> [(ListF a b, String)]
    forall a. [a] -> [a] -> [a]
    ++ ReadS (ListF a b)
    cons String
    s
        where
          nil :: String -> [(ListF a b, String)]
    nil String
    s0 = do
            ("Nil", s1) <- ReadS String
    lex String
    s0
            return (Nil, s1)
          cons :: ReadS (ListF a b)
    cons String
    s0 = do
            ("Cons", s1) <- ReadS String
    lex String
    s0
            (a,      s2) <- ra 11 s1
            (b,      s3) <- rb 11 s2
            return (Cons a b, s3)

    instance Read a => Read1 (ListF a) where
      liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ListF a a)
    liftReadsPrec = (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS a)
    -> ReadS [a]
    -> Int
    -> ReadS (ListF a a)
    forall a b.
    (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS b)
    -> ReadS [b]
    -> Int
    -> ReadS (ListF 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

    instance Bi.Bifunctor ListF where
      bimap :: forall a b c d. (a -> b) -> (c -> d) -> ListF a c -> ListF b d
    bimap a -> b
    _ c -> d
    _ ListF a c
    Nil        = ListF b d
    forall a b. ListF a b
    Nil
      bimap a -> b
    f c -> d
    g (Cons a
    a c
    b) = b -> d -> ListF b d
    forall a b. a -> b -> ListF a b
    Cons (a -> b
    f a
    a) (c -> d
    g c
    b)

    instance Bi.Bifoldable ListF where
      bifoldMap :: forall m a b. Monoid m => (a -> m) -> (b -> m) -> ListF a b -> m
    bifoldMap a -> m
    _ b -> m
    _ ListF a b
    Nil        = m
    forall a. Monoid a => a
    mempty
      bifoldMap a -> m
    f b -> m
    g (Cons a
    a b
    b) = m -> m -> m
    forall a. Monoid a => a -> a -> a
    mappend (a -> m
    f a
    a) (b -> m
    g b
    b)

    instance Bi.Bitraversable ListF where
      bitraverse :: forall (f :: * -> *) a c b d.
    Applicative f =>
    (a -> f c) -> (b -> f d) -> ListF a b -> f (ListF c d)
    bitraverse a -> f c
    _ b -> f d
    _ ListF a b
    Nil        = ListF c d -> f (ListF c d)
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ListF c d
    forall a b. ListF a b
    Nil
      bitraverse a -> f c
    f b -> f d
    g (Cons a
    a b
    b) = c -> d -> ListF c d
    forall a b. a -> b -> ListF a b
    Cons (c -> d -> ListF c d) -> f c -> f (d -> ListF c d)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> a -> f c
    f a
    a f (d -> ListF c d) -> f d -> f (ListF c d)
    forall a b. f (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> b -> f d
    g b
    b

    -------------------------------------------------------------------------------
    -- NonEmpty
    -------------------------------------------------------------------------------

    -- | Base Functor for 'Data.List.NonEmpty'
    data NonEmptyF a b = NonEmptyF { forall a b. NonEmptyF a b -> a
    head :: a, forall a b. NonEmptyF a b -> Maybe b
    tail :: Maybe b }
      deriving (NonEmptyF a b -> NonEmptyF a b -> Bool
    (NonEmptyF a b -> NonEmptyF a b -> Bool)
    -> (NonEmptyF a b -> NonEmptyF a b -> Bool) -> Eq (NonEmptyF a b)
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    forall a b. (Eq a, Eq b) => NonEmptyF a b -> NonEmptyF a b -> Bool
    $c== :: forall a b. (Eq a, Eq b) => NonEmptyF a b -> NonEmptyF a b -> Bool
    == :: NonEmptyF a b -> NonEmptyF a b -> Bool
    $c/= :: forall a b. (Eq a, Eq b) => NonEmptyF a b -> NonEmptyF a b -> Bool
    /= :: NonEmptyF a b -> NonEmptyF a b -> Bool
    Eq,Eq (NonEmptyF a b)
    Eq (NonEmptyF a b) =>
    (NonEmptyF a b -> NonEmptyF a b -> Ordering)
    -> (NonEmptyF a b -> NonEmptyF a b -> Bool)
    -> (NonEmptyF a b -> NonEmptyF a b -> Bool)
    -> (NonEmptyF a b -> NonEmptyF a b -> Bool)
    -> (NonEmptyF a b -> NonEmptyF a b -> Bool)
    -> (NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b)
    -> (NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b)
    -> Ord (NonEmptyF a b)
    NonEmptyF a b -> NonEmptyF a b -> Bool
    NonEmptyF a b -> NonEmptyF a b -> Ordering
    NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b
    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 b. (Ord a, Ord b) => Eq (NonEmptyF a b)
    forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Bool
    forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Ordering
    forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b
    $ccompare :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Ordering
    compare :: NonEmptyF a b -> NonEmptyF a b -> Ordering
    $c< :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Bool
    < :: NonEmptyF a b -> NonEmptyF a b -> Bool
    $c<= :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Bool
    <= :: NonEmptyF a b -> NonEmptyF a b -> Bool
    $c> :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Bool
    > :: NonEmptyF a b -> NonEmptyF a b -> Bool
    $c>= :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> Bool
    >= :: NonEmptyF a b -> NonEmptyF a b -> Bool
    $cmax :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b
    max :: NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b
    $cmin :: forall a b.
    (Ord a, Ord b) =>
    NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b
    min :: NonEmptyF a b -> NonEmptyF a b -> NonEmptyF a b
    Ord,Int -> NonEmptyF a b -> ShowS
    [NonEmptyF a b] -> ShowS
    NonEmptyF a b -> String
    (Int -> NonEmptyF a b -> ShowS)
    -> (NonEmptyF a b -> String)
    -> ([NonEmptyF a b] -> ShowS)
    -> Show (NonEmptyF a b)
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    forall a b. (Show a, Show b) => Int -> NonEmptyF a b -> ShowS
    forall a b. (Show a, Show b) => [NonEmptyF a b] -> ShowS
    forall a b. (Show a, Show b) => NonEmptyF a b -> String
    $cshowsPrec :: forall a b. (Show a, Show b) => Int -> NonEmptyF a b -> ShowS
    showsPrec :: Int -> NonEmptyF a b -> ShowS
    $cshow :: forall a b. (Show a, Show b) => NonEmptyF a b -> String
    show :: NonEmptyF a b -> String
    $cshowList :: forall a b. (Show a, Show b) => [NonEmptyF a b] -> ShowS
    showList :: [NonEmptyF a b] -> ShowS
    Show,ReadPrec [NonEmptyF a b]
    ReadPrec (NonEmptyF a b)
    Int -> ReadS (NonEmptyF a b)
    ReadS [NonEmptyF a b]
    (Int -> ReadS (NonEmptyF a b))
    -> ReadS [NonEmptyF a b]
    -> ReadPrec (NonEmptyF a b)
    -> ReadPrec [NonEmptyF a b]
    -> Read (NonEmptyF a b)
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    forall a b. (Read a, Read b) => ReadPrec [NonEmptyF a b]
    forall a b. (Read a, Read b) => ReadPrec (NonEmptyF a b)
    forall a b. (Read a, Read b) => Int -> ReadS (NonEmptyF a b)
    forall a b. (Read a, Read b) => ReadS [NonEmptyF a b]
    $creadsPrec :: forall a b. (Read a, Read b) => Int -> ReadS (NonEmptyF a b)
    readsPrec :: Int -> ReadS (NonEmptyF a b)
    $creadList :: forall a b. (Read a, Read b) => ReadS [NonEmptyF a b]
    readList :: ReadS [NonEmptyF a b]
    $creadPrec :: forall a b. (Read a, Read b) => ReadPrec (NonEmptyF a b)
    readPrec :: ReadPrec (NonEmptyF a b)
    $creadListPrec :: forall a b. (Read a, Read b) => ReadPrec [NonEmptyF a b]
    readListPrec :: ReadPrec [NonEmptyF a b]
    Read,(forall x. NonEmptyF a b -> Rep (NonEmptyF a b) x)
    -> (forall x. Rep (NonEmptyF a b) x -> NonEmptyF a b)
    -> Generic (NonEmptyF a b)
    forall x. Rep (NonEmptyF a b) x -> NonEmptyF a b
    forall x. NonEmptyF a b -> Rep (NonEmptyF a b) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall a b x. Rep (NonEmptyF a b) x -> NonEmptyF a b
    forall a b x. NonEmptyF a b -> Rep (NonEmptyF a b) x
    $cfrom :: forall a b x. NonEmptyF a b -> Rep (NonEmptyF a b) x
    from :: forall x. NonEmptyF a b -> Rep (NonEmptyF a b) x
    $cto :: forall a b x. Rep (NonEmptyF a b) x -> NonEmptyF a b
    to :: forall x. Rep (NonEmptyF a b) x -> NonEmptyF a b
    Generic,(forall a. NonEmptyF a a -> Rep1 (NonEmptyF a) a)
    -> (forall a. Rep1 (NonEmptyF a) a -> NonEmptyF a a)
    -> Generic1 (NonEmptyF a)
    forall a. Rep1 (NonEmptyF a) a -> NonEmptyF a a
    forall a. NonEmptyF a a -> Rep1 (NonEmptyF a) a
    forall a a. Rep1 (NonEmptyF a) a -> NonEmptyF a a
    forall a a. NonEmptyF a a -> Rep1 (NonEmptyF a) a
    forall k (f :: k -> *).
    (forall (a :: k). f a -> Rep1 f a)
    -> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
    $cfrom1 :: forall a a. NonEmptyF a a -> Rep1 (NonEmptyF a) a
    from1 :: forall a. NonEmptyF a a -> Rep1 (NonEmptyF a) a
    $cto1 :: forall a a. Rep1 (NonEmptyF a) a -> NonEmptyF a a
    to1 :: forall a. Rep1 (NonEmptyF a) a -> NonEmptyF a a
    Generic1,(forall a b. (a -> b) -> NonEmptyF a a -> NonEmptyF a b)
    -> (forall a b. a -> NonEmptyF a b -> NonEmptyF a a)
    -> Functor (NonEmptyF a)
    forall a b. a -> NonEmptyF a b -> NonEmptyF a a
    forall a b. (a -> b) -> NonEmptyF a a -> NonEmptyF a b
    forall a a b. a -> NonEmptyF a b -> NonEmptyF a a
    forall a a b. (a -> b) -> NonEmptyF a a -> NonEmptyF a b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall a a b. (a -> b) -> NonEmptyF a a -> NonEmptyF a b
    fmap :: forall a b. (a -> b) -> NonEmptyF a a -> NonEmptyF a b
    $c<$ :: forall a a b. a -> NonEmptyF a b -> NonEmptyF a a
    <$ :: forall a b. a -> NonEmptyF a b -> NonEmptyF a a
    Functor,(forall m. Monoid m => NonEmptyF a m -> m)
    -> (forall m a. Monoid m => (a -> m) -> NonEmptyF a a -> m)
    -> (forall m a. Monoid m => (a -> m) -> NonEmptyF a a -> m)
    -> (forall a b. (a -> b -> b) -> b -> NonEmptyF a a -> b)
    -> (forall a b. (a -> b -> b) -> b -> NonEmptyF a a -> b)
    -> (forall b a. (b -> a -> b) -> b -> NonEmptyF a a -> b)
    -> (forall b a. (b -> a -> b) -> b -> NonEmptyF a a -> b)
    -> (forall a. (a -> a -> a) -> NonEmptyF a a -> a)
    -> (forall a. (a -> a -> a) -> NonEmptyF a a -> a)
    -> (forall a. NonEmptyF a a -> [a])
    -> (forall a. NonEmptyF a a -> Bool)
    -> (forall a. NonEmptyF a a -> Int)
    -> (forall a. Eq a => a -> NonEmptyF a a -> Bool)
    -> (forall a. Ord a => NonEmptyF a a -> a)
    -> (forall a. Ord a => NonEmptyF a a -> a)
    -> (forall a. Num a => NonEmptyF a a -> a)
    -> (forall a. Num a => NonEmptyF a a -> a)
    -> Foldable (NonEmptyF a)
    forall a. Eq a => a -> NonEmptyF a a -> Bool
    forall a. Num a => NonEmptyF a a -> a
    forall a. Ord a => NonEmptyF a a -> a
    forall m. Monoid m => NonEmptyF a m -> m
    forall a. NonEmptyF a a -> Bool
    forall a. NonEmptyF a a -> Int
    forall a. NonEmptyF a a -> [a]
    forall a. (a -> a -> a) -> NonEmptyF a a -> a
    forall a a. Eq a => a -> NonEmptyF a a -> Bool
    forall a a. Num a => NonEmptyF a a -> a
    forall a a. Ord a => NonEmptyF a a -> a
    forall a m. Monoid m => NonEmptyF a m -> m
    forall m a. Monoid m => (a -> m) -> NonEmptyF a a -> m
    forall a a. NonEmptyF a a -> Bool
    forall a a. NonEmptyF a a -> Int
    forall a a. NonEmptyF a a -> [a]
    forall b a. (b -> a -> b) -> b -> NonEmptyF a a -> b
    forall a b. (a -> b -> b) -> b -> NonEmptyF a a -> b
    forall a a. (a -> a -> a) -> NonEmptyF a a -> a
    forall a m a. Monoid m => (a -> m) -> NonEmptyF a a -> m
    forall a b a. (b -> a -> b) -> b -> NonEmptyF a a -> b
    forall a a b. (a -> b -> b) -> b -> NonEmptyF a 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
    $cfold :: forall a m. Monoid m => NonEmptyF a m -> m
    fold :: forall m. Monoid m => NonEmptyF a m -> m
    $cfoldMap :: forall a m a. Monoid m => (a -> m) -> NonEmptyF a a -> m
    foldMap :: forall m a. Monoid m => (a -> m) -> NonEmptyF a a -> m
    $cfoldMap' :: forall a m a. Monoid m => (a -> m) -> NonEmptyF a a -> m
    foldMap' :: forall m a. Monoid m => (a -> m) -> NonEmptyF a a -> m
    $cfoldr :: forall a a b. (a -> b -> b) -> b -> NonEmptyF a a -> b
    foldr :: forall a b. (a -> b -> b) -> b -> NonEmptyF a a -> b
    $cfoldr' :: forall a a b. (a -> b -> b) -> b -> NonEmptyF a a -> b
    foldr' :: forall a b. (a -> b -> b) -> b -> NonEmptyF a a -> b
    $cfoldl :: forall a b a. (b -> a -> b) -> b -> NonEmptyF a a -> b
    foldl :: forall b a. (b -> a -> b) -> b -> NonEmptyF a a -> b
    $cfoldl' :: forall a b a. (b -> a -> b) -> b -> NonEmptyF a a -> b
    foldl' :: forall b a. (b -> a -> b) -> b -> NonEmptyF a a -> b
    $cfoldr1 :: forall a a. (a -> a -> a) -> NonEmptyF a a -> a
    foldr1 :: forall a. (a -> a -> a) -> NonEmptyF a a -> a
    $cfoldl1 :: forall a a. (a -> a -> a) -> NonEmptyF a a -> a
    foldl1 :: forall a. (a -> a -> a) -> NonEmptyF a a -> a
    $ctoList :: forall a a. NonEmptyF a a -> [a]
    toList :: forall a. NonEmptyF a a -> [a]
    $cnull :: forall a a. NonEmptyF a a -> Bool
    null :: forall a. NonEmptyF a a -> Bool
    $clength :: forall a a. NonEmptyF a a -> Int
    length :: forall a. NonEmptyF a a -> Int
    $celem :: forall a a. Eq a => a -> NonEmptyF a a -> Bool
    elem :: forall a. Eq a => a -> NonEmptyF a a -> Bool
    $cmaximum :: forall a a. Ord a => NonEmptyF a a -> a
    maximum :: forall a. Ord a => NonEmptyF a a -> a
    $cminimum :: forall a a. Ord a => NonEmptyF a a -> a
    minimum :: forall a. Ord a => NonEmptyF a a -> a
    $csum :: forall a a. Num a => NonEmptyF a a -> a
    sum :: forall a. Num a => NonEmptyF a a -> a
    $cproduct :: forall a a. Num a => NonEmptyF a a -> a
    product :: forall a. Num a => NonEmptyF a a -> a
    F.Foldable,Functor (NonEmptyF a)
    Foldable (NonEmptyF a)
    (Functor (NonEmptyF a), Foldable (NonEmptyF a)) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> NonEmptyF a a -> f (NonEmptyF a b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        NonEmptyF a (f a) -> f (NonEmptyF a a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> NonEmptyF a a -> m (NonEmptyF a b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        NonEmptyF a (m a) -> m (NonEmptyF a a))
    -> Traversable (NonEmptyF a)
    forall a. Functor (NonEmptyF a)
    forall a. Foldable (NonEmptyF a)
    forall a (m :: * -> *) a.
    Monad m =>
    NonEmptyF a (m a) -> m (NonEmptyF a a)
    forall a (f :: * -> *) a.
    Applicative f =>
    NonEmptyF a (f a) -> f (NonEmptyF a a)
    forall a (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> NonEmptyF a a -> m (NonEmptyF a b)
    forall a (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> NonEmptyF a a -> f (NonEmptyF a 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 =>
    NonEmptyF a (m a) -> m (NonEmptyF a a)
    forall (f :: * -> *) a.
    Applicative f =>
    NonEmptyF a (f a) -> f (NonEmptyF a a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> NonEmptyF a a -> m (NonEmptyF a b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> NonEmptyF a a -> f (NonEmptyF a b)
    $ctraverse :: forall a (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> NonEmptyF a a -> f (NonEmptyF a b)
    traverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> NonEmptyF a a -> f (NonEmptyF a b)
    $csequenceA :: forall a (f :: * -> *) a.
    Applicative f =>
    NonEmptyF a (f a) -> f (NonEmptyF a a)
    sequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    NonEmptyF a (f a) -> f (NonEmptyF a a)
    $cmapM :: forall a (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> NonEmptyF a a -> m (NonEmptyF a b)
    mapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> NonEmptyF a a -> m (NonEmptyF a b)
    $csequence :: forall a (m :: * -> *) a.
    Monad m =>
    NonEmptyF a (m a) -> m (NonEmptyF a a)
    sequence :: forall (m :: * -> *) a.
    Monad m =>
    NonEmptyF a (m a) -> m (NonEmptyF a a)
    T.Traversable)

    instance Eq2 NonEmptyF where
      liftEq2 :: forall a b c d.
    (a -> b -> Bool)
    -> (c -> d -> Bool) -> NonEmptyF a c -> NonEmptyF b d -> Bool
    liftEq2 a -> b -> Bool
    f c -> d -> Bool
    g (NonEmptyF a
    a Maybe c
    mb) (NonEmptyF b
    a' Maybe d
    mb') = a -> b -> Bool
    f a
    a b
    a' Bool -> Bool -> Bool
    && (c -> d -> Bool) -> Maybe c -> Maybe d -> Bool
    forall a b. (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq c -> d -> Bool
    g Maybe c
    mb Maybe d
    mb'

    instance Eq a => Eq1 (NonEmptyF a) where
      liftEq :: forall a b.
    (a -> b -> Bool) -> NonEmptyF a a -> NonEmptyF a b -> Bool
    liftEq = (a -> a -> Bool)
    -> (a -> b -> Bool) -> NonEmptyF a a -> NonEmptyF a b -> Bool
    forall a b c d.
    (a -> b -> Bool)
    -> (c -> d -> Bool) -> NonEmptyF a c -> NonEmptyF b d -> 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 Ord2 NonEmptyF where
      liftCompare2 :: forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering)
    -> NonEmptyF a c
    -> NonEmptyF b d
    -> Ordering
    liftCompare2 a -> b -> Ordering
    f c -> d -> Ordering
    g (NonEmptyF a
    a Maybe c
    mb) (NonEmptyF b
    a' Maybe d
    mb') = a -> b -> Ordering
    f a
    a b
    a' Ordering -> Ordering -> Ordering
    forall a. Monoid a => a -> a -> a
    `mappend` (c -> d -> Ordering) -> Maybe c -> Maybe d -> Ordering
    forall a b. (a -> b -> Ordering) -> Maybe a -> Maybe b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare c -> d -> Ordering
    g Maybe c
    mb Maybe d
    mb'

    instance Ord a => Ord1 (NonEmptyF a) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> NonEmptyF a a -> NonEmptyF a b -> Ordering
    liftCompare = (a -> a -> Ordering)
    -> (a -> b -> Ordering)
    -> NonEmptyF a a
    -> NonEmptyF a b
    -> Ordering
    forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering)
    -> NonEmptyF a c
    -> NonEmptyF b d
    -> 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 Show a => Show1 (NonEmptyF a) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS) -> Int -> NonEmptyF a a -> ShowS
    liftShowsPrec = (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> Int
    -> NonEmptyF a a
    -> ShowS
    forall a b.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> b -> ShowS)
    -> ([b] -> ShowS)
    -> Int
    -> NonEmptyF 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

    instance Show2 NonEmptyF where
      liftShowsPrec2 :: forall a b.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> b -> ShowS)
    -> ([b] -> ShowS)
    -> Int
    -> NonEmptyF a b
    -> ShowS
    liftShowsPrec2 Int -> a -> ShowS
    sa [a] -> ShowS
    _ Int -> b -> ShowS
    sb [b] -> ShowS
    slb Int
    d (NonEmptyF a
    a Maybe b
    b) = 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
    "NonEmptyF "
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> a -> ShowS
    sa Int
    11 a
    a
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    " "
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Maybe b -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Maybe a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> b -> ShowS
    sb [b] -> ShowS
    slb Int
    11 Maybe b
    b

    instance Read2 NonEmptyF where
      liftReadsPrec2 :: forall a b.
    (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS b)
    -> ReadS [b]
    -> Int
    -> ReadS (NonEmptyF a b)
    liftReadsPrec2 Int -> ReadS a
    ra ReadS [a]
    _ Int -> ReadS b
    rb ReadS [b]
    rlb Int
    d = Bool -> ReadS (NonEmptyF a b) -> ReadS (NonEmptyF a b)
    forall a. Bool -> ReadS a -> ReadS a
    readParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10) (ReadS (NonEmptyF a b) -> ReadS (NonEmptyF a b))
    -> ReadS (NonEmptyF a b) -> ReadS (NonEmptyF a b)
    forall a b. (a -> b) -> a -> b
    $ \String
    s -> ReadS (NonEmptyF a b)
    cons String
    s
        where
          cons :: ReadS (NonEmptyF a b)
    cons String
    s0 = do
            ("NonEmptyF", s1) <- ReadS String
    lex String
    s0
            (a,      s2) <- ra 11 s1
            (mb,     s3) <- liftReadsPrec rb rlb 11 s2
            return (NonEmptyF a mb, s3)

    instance Read a => Read1 (NonEmptyF a) where
      liftReadsPrec :: forall a.
    (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmptyF a a)
    liftReadsPrec = (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS a)
    -> ReadS [a]
    -> Int
    -> ReadS (NonEmptyF a a)
    forall a b.
    (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS b)
    -> ReadS [b]
    -> Int
    -> ReadS (NonEmptyF 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

    instance Bi.Bifunctor NonEmptyF where
      bimap :: forall a b c d.
    (a -> b) -> (c -> d) -> NonEmptyF a c -> NonEmptyF b d
    bimap a -> b
    f c -> d
    g = b -> Maybe d -> NonEmptyF b d
    forall a b. a -> Maybe b -> NonEmptyF a b
    NonEmptyF (b -> Maybe d -> NonEmptyF b d)
    -> (NonEmptyF a c -> b)
    -> NonEmptyF a c
    -> Maybe d
    -> NonEmptyF b d
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (a -> b
    f (a -> b) -> (NonEmptyF a c -> a) -> NonEmptyF a c -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmptyF a c -> a
    forall a b. NonEmptyF a b -> a
    head) (NonEmptyF a c -> Maybe d -> NonEmptyF b d)
    -> (NonEmptyF a c -> Maybe d) -> NonEmptyF a c -> NonEmptyF b d
    forall a b.
    (NonEmptyF a c -> a -> b)
    -> (NonEmptyF a c -> a) -> NonEmptyF a c -> b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ((c -> d) -> Maybe c -> Maybe d
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap c -> d
    g (Maybe c -> Maybe d)
    -> (NonEmptyF a c -> Maybe c) -> NonEmptyF a c -> Maybe d
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmptyF a c -> Maybe c
    forall a b. NonEmptyF a b -> Maybe b
    tail)

    instance Bi.Bifoldable NonEmptyF where
      bifoldMap :: forall m a b.
    Monoid m =>
    (a -> m) -> (b -> m) -> NonEmptyF a b -> m
    bifoldMap a -> m
    f b -> m
    g = m -> Maybe m -> m
    forall {b}. Monoid b => b -> Maybe b -> b
    merge (m -> Maybe m -> m)
    -> (NonEmptyF a b -> m) -> NonEmptyF a b -> Maybe m -> m
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (a -> m
    f (a -> m) -> (NonEmptyF a b -> a) -> NonEmptyF a b -> m
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmptyF a b -> a
    forall a b. NonEmptyF a b -> a
    head) (NonEmptyF a b -> Maybe m -> m)
    -> (NonEmptyF a b -> Maybe m) -> NonEmptyF a b -> m
    forall a b.
    (NonEmptyF a b -> a -> b)
    -> (NonEmptyF a b -> a) -> NonEmptyF a b -> b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ((b -> m) -> Maybe b -> Maybe m
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap b -> m
    g (Maybe b -> Maybe m)
    -> (NonEmptyF a b -> Maybe b) -> NonEmptyF a b -> Maybe m
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmptyF a b -> Maybe b
    forall a b. NonEmptyF a b -> Maybe b
    tail)
        where merge :: b -> Maybe b -> b
    merge b
    x Maybe b
    my = b -> (b -> b) -> Maybe b -> b
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe b
    x (b -> b -> b
    forall a. Monoid a => a -> a -> a
    mappend b
    x) Maybe b
    my

    instance Bi.Bitraversable NonEmptyF where
      bitraverse :: forall (f :: * -> *) a c b d.
    Applicative f =>
    (a -> f c) -> (b -> f d) -> NonEmptyF a b -> f (NonEmptyF c d)
    bitraverse a -> f c
    f b -> f d
    g = (c -> Maybe d -> NonEmptyF c d)
    -> f c -> f (Maybe d) -> f (NonEmptyF c d)
    forall a b c. (a -> b -> c) -> f a -> f b -> f c
    forall (f :: * -> *) a b c.
    Applicative f =>
    (a -> b -> c) -> f a -> f b -> f c
    liftA2 c -> Maybe d -> NonEmptyF c d
    forall a b. a -> Maybe b -> NonEmptyF a b
    NonEmptyF (f c -> f (Maybe d) -> f (NonEmptyF c d))
    -> (NonEmptyF a b -> f c)
    -> NonEmptyF a b
    -> f (Maybe d)
    -> f (NonEmptyF c d)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (a -> f c
    f (a -> f c) -> (NonEmptyF a b -> a) -> NonEmptyF a b -> f c
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmptyF a b -> a
    forall a b. NonEmptyF a b -> a
    head) (NonEmptyF a b -> f (Maybe d) -> f (NonEmptyF c d))
    -> (NonEmptyF a b -> f (Maybe d))
    -> NonEmptyF a b
    -> f (NonEmptyF c d)
    forall a b.
    (NonEmptyF a b -> a -> b)
    -> (NonEmptyF a b -> a) -> NonEmptyF a b -> b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ((b -> f d) -> Maybe b -> f (Maybe d)
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    (a -> f b) -> t a -> f (t b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Maybe a -> f (Maybe b)
    T.traverse b -> f d
    g (Maybe b -> f (Maybe d))
    -> (NonEmptyF a b -> Maybe b) -> NonEmptyF a b -> f (Maybe d)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NonEmptyF a b -> Maybe b
    forall a b. NonEmptyF a b -> Maybe b
    tail)

    -------------------------------------------------------------------------------
    -- Tree
    -------------------------------------------------------------------------------

    -- | Base functor for 'Data.Tree.Tree'.
    data TreeF a b = NodeF a (ForestF a b)
      deriving (TreeF a b -> TreeF a b -> Bool
    (TreeF a b -> TreeF a b -> Bool)
    -> (TreeF a b -> TreeF a b -> Bool) -> Eq (TreeF a b)
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    forall a b. (Eq a, Eq b) => TreeF a b -> TreeF a b -> Bool
    $c== :: forall a b. (Eq a, Eq b) => TreeF a b -> TreeF a b -> Bool
    == :: TreeF a b -> TreeF a b -> Bool
    $c/= :: forall a b. (Eq a, Eq b) => TreeF a b -> TreeF a b -> Bool
    /= :: TreeF a b -> TreeF a b -> Bool
    Eq,Eq (TreeF a b)
    Eq (TreeF a b) =>
    (TreeF a b -> TreeF a b -> Ordering)
    -> (TreeF a b -> TreeF a b -> Bool)
    -> (TreeF a b -> TreeF a b -> Bool)
    -> (TreeF a b -> TreeF a b -> Bool)
    -> (TreeF a b -> TreeF a b -> Bool)
    -> (TreeF a b -> TreeF a b -> TreeF a b)
    -> (TreeF a b -> TreeF a b -> TreeF a b)
    -> Ord (TreeF a b)
    TreeF a b -> TreeF a b -> Bool
    TreeF a b -> TreeF a b -> Ordering
    TreeF a b -> TreeF a b -> TreeF a b
    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 b. (Ord a, Ord b) => Eq (TreeF a b)
    forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Bool
    forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Ordering
    forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> TreeF a b
    $ccompare :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Ordering
    compare :: TreeF a b -> TreeF a b -> Ordering
    $c< :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Bool
    < :: TreeF a b -> TreeF a b -> Bool
    $c<= :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Bool
    <= :: TreeF a b -> TreeF a b -> Bool
    $c> :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Bool
    > :: TreeF a b -> TreeF a b -> Bool
    $c>= :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> Bool
    >= :: TreeF a b -> TreeF a b -> Bool
    $cmax :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> TreeF a b
    max :: TreeF a b -> TreeF a b -> TreeF a b
    $cmin :: forall a b. (Ord a, Ord b) => TreeF a b -> TreeF a b -> TreeF a b
    min :: TreeF a b -> TreeF a b -> TreeF a b
    Ord,Int -> TreeF a b -> ShowS
    [TreeF a b] -> ShowS
    TreeF a b -> String
    (Int -> TreeF a b -> ShowS)
    -> (TreeF a b -> String)
    -> ([TreeF a b] -> ShowS)
    -> Show (TreeF a b)
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    forall a b. (Show a, Show b) => Int -> TreeF a b -> ShowS
    forall a b. (Show a, Show b) => [TreeF a b] -> ShowS
    forall a b. (Show a, Show b) => TreeF a b -> String
    $cshowsPrec :: forall a b. (Show a, Show b) => Int -> TreeF a b -> ShowS
    showsPrec :: Int -> TreeF a b -> ShowS
    $cshow :: forall a b. (Show a, Show b) => TreeF a b -> String
    show :: TreeF a b -> String
    $cshowList :: forall a b. (Show a, Show b) => [TreeF a b] -> ShowS
    showList :: [TreeF a b] -> ShowS
    Show,ReadPrec [TreeF a b]
    ReadPrec (TreeF a b)
    Int -> ReadS (TreeF a b)
    ReadS [TreeF a b]
    (Int -> ReadS (TreeF a b))
    -> ReadS [TreeF a b]
    -> ReadPrec (TreeF a b)
    -> ReadPrec [TreeF a b]
    -> Read (TreeF a b)
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    forall a b. (Read a, Read b) => ReadPrec [TreeF a b]
    forall a b. (Read a, Read b) => ReadPrec (TreeF a b)
    forall a b. (Read a, Read b) => Int -> ReadS (TreeF a b)
    forall a b. (Read a, Read b) => ReadS [TreeF a b]
    $creadsPrec :: forall a b. (Read a, Read b) => Int -> ReadS (TreeF a b)
    readsPrec :: Int -> ReadS (TreeF a b)
    $creadList :: forall a b. (Read a, Read b) => ReadS [TreeF a b]
    readList :: ReadS [TreeF a b]
    $creadPrec :: forall a b. (Read a, Read b) => ReadPrec (TreeF a b)
    readPrec :: ReadPrec (TreeF a b)
    $creadListPrec :: forall a b. (Read a, Read b) => ReadPrec [TreeF a b]
    readListPrec :: ReadPrec [TreeF a b]
    Read,(forall x. TreeF a b -> Rep (TreeF a b) x)
    -> (forall x. Rep (TreeF a b) x -> TreeF a b)
    -> Generic (TreeF a b)
    forall x. Rep (TreeF a b) x -> TreeF a b
    forall x. TreeF a b -> Rep (TreeF a b) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall a b x. Rep (TreeF a b) x -> TreeF a b
    forall a b x. TreeF a b -> Rep (TreeF a b) x
    $cfrom :: forall a b x. TreeF a b -> Rep (TreeF a b) x
    from :: forall x. TreeF a b -> Rep (TreeF a b) x
    $cto :: forall a b x. Rep (TreeF a b) x -> TreeF a b
    to :: forall x. Rep (TreeF a b) x -> TreeF a b
    Generic,(forall a. TreeF a a -> Rep1 (TreeF a) a)
    -> (forall a. Rep1 (TreeF a) a -> TreeF a a) -> Generic1 (TreeF a)
    forall a. Rep1 (TreeF a) a -> TreeF a a
    forall a. TreeF a a -> Rep1 (TreeF a) a
    forall a a. Rep1 (TreeF a) a -> TreeF a a
    forall a a. TreeF a a -> Rep1 (TreeF a) a
    forall k (f :: k -> *).
    (forall (a :: k). f a -> Rep1 f a)
    -> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
    $cfrom1 :: forall a a. TreeF a a -> Rep1 (TreeF a) a
    from1 :: forall a. TreeF a a -> Rep1 (TreeF a) a
    $cto1 :: forall a a. Rep1 (TreeF a) a -> TreeF a a
    to1 :: forall a. Rep1 (TreeF a) a -> TreeF a a
    Generic1,(forall a b. (a -> b) -> TreeF a a -> TreeF a b)
    -> (forall a b. a -> TreeF a b -> TreeF a a) -> Functor (TreeF a)
    forall a b. a -> TreeF a b -> TreeF a a
    forall a b. (a -> b) -> TreeF a a -> TreeF a b
    forall a a b. a -> TreeF a b -> TreeF a a
    forall a a b. (a -> b) -> TreeF a a -> TreeF a b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall a a b. (a -> b) -> TreeF a a -> TreeF a b
    fmap :: forall a b. (a -> b) -> TreeF a a -> TreeF a b
    $c<$ :: forall a a b. a -> TreeF a b -> TreeF a a
    <$ :: forall a b. a -> TreeF a b -> TreeF a a
    Functor,(forall m. Monoid m => TreeF a m -> m)
    -> (forall m a. Monoid m => (a -> m) -> TreeF a a -> m)
    -> (forall m a. Monoid m => (a -> m) -> TreeF a a -> m)
    -> (forall a b. (a -> b -> b) -> b -> TreeF a a -> b)
    -> (forall a b. (a -> b -> b) -> b -> TreeF a a -> b)
    -> (forall b a. (b -> a -> b) -> b -> TreeF a a -> b)
    -> (forall b a. (b -> a -> b) -> b -> TreeF a a -> b)
    -> (forall a. (a -> a -> a) -> TreeF a a -> a)
    -> (forall a. (a -> a -> a) -> TreeF a a -> a)
    -> (forall a. TreeF a a -> [a])
    -> (forall a. TreeF a a -> Bool)
    -> (forall a. TreeF a a -> Int)
    -> (forall a. Eq a => a -> TreeF a a -> Bool)
    -> (forall a. Ord a => TreeF a a -> a)
    -> (forall a. Ord a => TreeF a a -> a)
    -> (forall a. Num a => TreeF a a -> a)
    -> (forall a. Num a => TreeF a a -> a)
    -> Foldable (TreeF a)
    forall a. Eq a => a -> TreeF a a -> Bool
    forall a. Num a => TreeF a a -> a
    forall a. Ord a => TreeF a a -> a
    forall m. Monoid m => TreeF a m -> m
    forall a. TreeF a a -> Bool
    forall a. TreeF a a -> Int
    forall a. TreeF a a -> [a]
    forall a. (a -> a -> a) -> TreeF a a -> a
    forall a a. Eq a => a -> TreeF a a -> Bool
    forall a a. Num a => TreeF a a -> a
    forall a a. Ord a => TreeF a a -> a
    forall a m. Monoid m => TreeF a m -> m
    forall m a. Monoid m => (a -> m) -> TreeF a a -> m
    forall a a. TreeF a a -> Bool
    forall a a. TreeF a a -> Int
    forall a a. TreeF a a -> [a]
    forall b a. (b -> a -> b) -> b -> TreeF a a -> b
    forall a b. (a -> b -> b) -> b -> TreeF a a -> b
    forall a a. (a -> a -> a) -> TreeF a a -> a
    forall a m a. Monoid m => (a -> m) -> TreeF a a -> m
    forall a b a. (b -> a -> b) -> b -> TreeF a a -> b
    forall a a b. (a -> b -> b) -> b -> TreeF a 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
    $cfold :: forall a m. Monoid m => TreeF a m -> m
    fold :: forall m. Monoid m => TreeF a m -> m
    $cfoldMap :: forall a m a. Monoid m => (a -> m) -> TreeF a a -> m
    foldMap :: forall m a. Monoid m => (a -> m) -> TreeF a a -> m
    $cfoldMap' :: forall a m a. Monoid m => (a -> m) -> TreeF a a -> m
    foldMap' :: forall m a. Monoid m => (a -> m) -> TreeF a a -> m
    $cfoldr :: forall a a b. (a -> b -> b) -> b -> TreeF a a -> b
    foldr :: forall a b. (a -> b -> b) -> b -> TreeF a a -> b
    $cfoldr' :: forall a a b. (a -> b -> b) -> b -> TreeF a a -> b
    foldr' :: forall a b. (a -> b -> b) -> b -> TreeF a a -> b
    $cfoldl :: forall a b a. (b -> a -> b) -> b -> TreeF a a -> b
    foldl :: forall b a. (b -> a -> b) -> b -> TreeF a a -> b
    $cfoldl' :: forall a b a. (b -> a -> b) -> b -> TreeF a a -> b
    foldl' :: forall b a. (b -> a -> b) -> b -> TreeF a a -> b
    $cfoldr1 :: forall a a. (a -> a -> a) -> TreeF a a -> a
    foldr1 :: forall a. (a -> a -> a) -> TreeF a a -> a
    $cfoldl1 :: forall a a. (a -> a -> a) -> TreeF a a -> a
    foldl1 :: forall a. (a -> a -> a) -> TreeF a a -> a
    $ctoList :: forall a a. TreeF a a -> [a]
    toList :: forall a. TreeF a a -> [a]
    $cnull :: forall a a. TreeF a a -> Bool
    null :: forall a. TreeF a a -> Bool
    $clength :: forall a a. TreeF a a -> Int
    length :: forall a. TreeF a a -> Int
    $celem :: forall a a. Eq a => a -> TreeF a a -> Bool
    elem :: forall a. Eq a => a -> TreeF a a -> Bool
    $cmaximum :: forall a a. Ord a => TreeF a a -> a
    maximum :: forall a. Ord a => TreeF a a -> a
    $cminimum :: forall a a. Ord a => TreeF a a -> a
    minimum :: forall a. Ord a => TreeF a a -> a
    $csum :: forall a a. Num a => TreeF a a -> a
    sum :: forall a. Num a => TreeF a a -> a
    $cproduct :: forall a a. Num a => TreeF a a -> a
    product :: forall a. Num a => TreeF a a -> a
    F.Foldable,Functor (TreeF a)
    Foldable (TreeF a)
    (Functor (TreeF a), Foldable (TreeF a)) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> TreeF a a -> f (TreeF a b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        TreeF a (f a) -> f (TreeF a a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> TreeF a a -> m (TreeF a b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        TreeF a (m a) -> m (TreeF a a))
    -> Traversable (TreeF a)
    forall a. Functor (TreeF a)
    forall a. Foldable (TreeF a)
    forall a (m :: * -> *) a. Monad m => TreeF a (m a) -> m (TreeF a a)
    forall a (f :: * -> *) a.
    Applicative f =>
    TreeF a (f a) -> f (TreeF a a)
    forall a (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TreeF a a -> m (TreeF a b)
    forall a (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TreeF a a -> f (TreeF a 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 => TreeF a (m a) -> m (TreeF a a)
    forall (f :: * -> *) a.
    Applicative f =>
    TreeF a (f a) -> f (TreeF a a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TreeF a a -> m (TreeF a b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TreeF a a -> f (TreeF a b)
    $ctraverse :: forall a (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TreeF a a -> f (TreeF a b)
    traverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TreeF a a -> f (TreeF a b)
    $csequenceA :: forall a (f :: * -> *) a.
    Applicative f =>
    TreeF a (f a) -> f (TreeF a a)
    sequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    TreeF a (f a) -> f (TreeF a a)
    $cmapM :: forall a (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TreeF a a -> m (TreeF a b)
    mapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TreeF a a -> m (TreeF a b)
    $csequence :: forall a (m :: * -> *) a. Monad m => TreeF a (m a) -> m (TreeF a a)
    sequence :: forall (m :: * -> *) a. Monad m => TreeF a (m a) -> m (TreeF a a)
    T.Traversable)

    type ForestF a b = [b]

    instance Eq2 TreeF where
      liftEq2 :: forall a b c d.
    (a -> b -> Bool)
    -> (c -> d -> Bool) -> TreeF a c -> TreeF b d -> Bool
    liftEq2 a -> b -> Bool
    f c -> d -> Bool
    g (NodeF a
    a ForestF a c
    mb) (NodeF b
    a' ForestF b d
    mb') = a -> b -> Bool
    f a
    a b
    a' Bool -> Bool -> Bool
    && (c -> d -> Bool) -> ForestF a c -> ForestF b d -> Bool
    forall a b. (a -> b -> Bool) -> [a] -> [b] -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq c -> d -> Bool
    g ForestF a c
    mb ForestF b d
    mb'

    instance Eq a => Eq1 (TreeF a) where
      liftEq :: forall a b. (a -> b -> Bool) -> TreeF a a -> TreeF a b -> Bool
    liftEq = (a -> a -> Bool)
    -> (a -> b -> Bool) -> TreeF a a -> TreeF a b -> Bool
    forall a b c d.
    (a -> b -> Bool)
    -> (c -> d -> Bool) -> TreeF a c -> TreeF b d -> 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 Ord2 TreeF where
      liftCompare2 :: forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering) -> TreeF a c -> TreeF b d -> Ordering
    liftCompare2 a -> b -> Ordering
    f c -> d -> Ordering
    g (NodeF a
    a ForestF a c
    mb) (NodeF b
    a' ForestF b d
    mb') = a -> b -> Ordering
    f a
    a b
    a' Ordering -> Ordering -> Ordering
    forall a. Monoid a => a -> a -> a
    `mappend` (c -> d -> Ordering) -> ForestF a c -> ForestF b d -> Ordering
    forall a b. (a -> b -> Ordering) -> [a] -> [b] -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare c -> d -> Ordering
    g ForestF a c
    mb ForestF b d
    mb'

    instance Ord a => Ord1 (TreeF a) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> TreeF a a -> TreeF a b -> Ordering
    liftCompare = (a -> a -> Ordering)
    -> (a -> b -> Ordering) -> TreeF a a -> TreeF a b -> Ordering
    forall a b c d.
    (a -> b -> Ordering)
    -> (c -> d -> Ordering) -> TreeF a c -> TreeF b d -> 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 Show a => Show1 (TreeF a) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> TreeF a a -> ShowS
    liftShowsPrec = (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> Int
    -> TreeF a a
    -> ShowS
    forall a b.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> b -> ShowS)
    -> ([b] -> ShowS)
    -> Int
    -> TreeF 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

    instance Show2 TreeF where
      liftShowsPrec2 :: forall a b.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS)
    -> (Int -> b -> ShowS)
    -> ([b] -> ShowS)
    -> Int
    -> TreeF a b
    -> ShowS
    liftShowsPrec2 Int -> a -> ShowS
    sa [a] -> ShowS
    _ Int -> b -> ShowS
    sb [b] -> ShowS
    slb Int
    d (NodeF a
    a [b]
    b) = 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
    "NodeF "
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> a -> ShowS
    sa Int
    11 a
    a
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    " "
        ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> [b] -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> [a] -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> b -> ShowS
    sb [b] -> ShowS
    slb Int
    11 [b]
    b

    instance Read2 TreeF where
      liftReadsPrec2 :: forall a b.
    (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS b)
    -> ReadS [b]
    -> Int
    -> ReadS (TreeF a b)
    liftReadsPrec2 Int -> ReadS a
    ra ReadS [a]
    _ Int -> ReadS b
    rb ReadS [b]
    rlb Int
    d = Bool -> ReadS (TreeF a b) -> ReadS (TreeF a b)
    forall a. Bool -> ReadS a -> ReadS a
    readParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10) (ReadS (TreeF a b) -> ReadS (TreeF a b))
    -> ReadS (TreeF a b) -> ReadS (TreeF a b)
    forall a b. (a -> b) -> a -> b
    $ \String
    s -> ReadS (TreeF a b)
    cons String
    s
        where
          cons :: ReadS (TreeF a b)
    cons String
    s0 = do
            ("NodeF", s1) <- ReadS String
    lex String
    s0
            (a,      s2) <- ra 11 s1
            (mb,     s3) <- liftReadsPrec rb rlb 11 s2
            return (NodeF a mb, s3)

    instance Read a => Read1 (TreeF a) where
      liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (TreeF a a)
    liftReadsPrec = (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS a)
    -> ReadS [a]
    -> Int
    -> ReadS (TreeF a a)
    forall a b.
    (Int -> ReadS a)
    -> ReadS [a]
    -> (Int -> ReadS b)
    -> ReadS [b]
    -> Int
    -> ReadS (TreeF 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

    instance Bi.Bifunctor TreeF where
      bimap :: forall a b c d. (a -> b) -> (c -> d) -> TreeF a c -> TreeF b d
    bimap a -> b
    f c -> d
    g (NodeF a
    x ForestF a c
    xs) = b -> ForestF b d -> TreeF b d
    forall a b. a -> ForestF a b -> TreeF a b
    NodeF (a -> b
    f a
    x) ((c -> d) -> ForestF a c -> ForestF b d
    forall a b. (a -> b) -> [a] -> [b]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap c -> d
    g ForestF a c
    xs)

    instance Bi.Bifoldable TreeF where
      bifoldMap :: forall m a b. Monoid m => (a -> m) -> (b -> m) -> TreeF a b -> m
    bifoldMap a -> m
    f b -> m
    g (NodeF a
    x ForestF a b
    xs) = a -> m
    f a
    x m -> m -> m
    forall a. Monoid a => a -> a -> a
    `mappend` (b -> m) -> ForestF a b -> m
    forall m a. Monoid m => (a -> m) -> [a] -> m
    forall (t :: * -> *) m a.
    (Foldable t, Monoid m) =>
    (a -> m) -> t a -> m
    F.foldMap b -> m
    g ForestF a b
    xs

    instance Bi.Bitraversable TreeF where
      bitraverse :: forall (f :: * -> *) a c b d.
    Applicative f =>
    (a -> f c) -> (b -> f d) -> TreeF a b -> f (TreeF c d)
    bitraverse a -> f c
    f b -> f d
    g (NodeF a
    x ForestF a b
    xs) = (c -> ForestF c d -> TreeF c d)
    -> f c -> f (ForestF c d) -> f (TreeF c d)
    forall a b c. (a -> b -> c) -> f a -> f b -> f c
    forall (f :: * -> *) a b c.
    Applicative f =>
    (a -> b -> c) -> f a -> f b -> f c
    liftA2 c -> ForestF c d -> TreeF c d
    forall a b. a -> ForestF a b -> TreeF a b
    NodeF (a -> f c
    f a
    x) ((b -> f d) -> ForestF a b -> f (ForestF c d)
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    (a -> f b) -> t a -> f (t b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> [a] -> f [b]
    T.traverse b -> f d
    g ForestF a b
    xs)