{-# LANGUAGE EmptyDataDeriving #-}

-- |
-- Module      : Control.Applicative.Step
-- Copyright   : (c) Justin Le 2019
-- License     : BSD3
--
-- Maintainer  : justin@jle.im
-- Stability   : experimental
-- Portability : non-portable
--
-- This module provides functor combinators that are the fixed points of
-- applications of ':+:' and 'Data.Functor.These.These1'.  They are useful
-- for their 'Data.HFunctor.Interpret.Interpret' instances, along with
-- their relationship to the 'Data.HBifunctor.Tensor.Monoidal' instances of
-- ':+:' and 'Data.Functor.These.These1'.
module Control.Applicative.Step (
  -- * Fixed Points
    Step(..)
  , Steps(..)
  , Flagged(..)
  -- ** Steppers
  , stepUp
  , stepDown
  , stepping
  , stepsUp
  , stepsDown
  , steppings
  -- * Void
  , absurd1
  , Void2
  , absurd2
  , Void3
  , absurd3
  ) where

import           Control.Natural
import           Control.Natural.IsoF
import           Data.Bifunctor
import           Data.Data
import           Data.Deriving
import           Data.Functor.Alt
import           Data.Functor.Bind
import           Data.Functor.Contravariant
import           Data.Functor.Contravariant.Conclude
import           Data.Functor.Contravariant.Decide
import           Data.Functor.Contravariant.Divise
import           Data.Functor.Contravariant.Divisible
import           Data.Functor.Invariant
import           Data.Functor.These
import           Data.Map.NonEmpty                    (NEMap)
import           Data.Pointed
import           Data.Semigroup
import           Data.Semigroup.Foldable
import           Data.Semigroup.Traversable
import           Data.These
import           GHC.Generics
import           GHC.Natural
import qualified Data.Map.NonEmpty                    as NEM

-- | An @f a@, along with a 'Natural' index.
--
-- @
-- 'Step' f a ~ ('Natural', f a)
-- Step f   ~ ((,) Natural) ':.:' f       -- functor composition
-- @
--
-- It is the fixed point of infinite applications of ':+:' (functor sums).
--
-- Intuitively, in an infinite @f :+: f :+: f :+: f ...@, you have
-- exactly one @f@ /somewhere/.  A @'Step' f a@ has that @f@, with
-- a 'Natural' giving you "where" the @f@ is in the long chain.
--
-- Can be useful for using with the 'Data.HBifunctor.Tensor.Monoidal'
-- instance of ':+:'.
--
-- 'Data.HFunctor.Interpret.interpret'ing it requires no constraint on the
-- target context.
--
-- Note that this type and its instances equivalent to
-- @'Control.Comonad.Trans.Env.EnvT' ('Data.Semigroup.Sum' 'Natural')@.
data Step f a = Step { forall {k} (f :: k -> *) (a :: k). Step f a -> Natural
stepPos :: Natural, forall {k} (f :: k -> *) (a :: k). Step f a -> f a
stepVal :: f a }
  deriving (Int -> Step f a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k -> *) (a :: k).
Show (f a) =>
Int -> Step f a -> ShowS
forall k (f :: k -> *) (a :: k). Show (f a) => [Step f a] -> ShowS
forall k (f :: k -> *) (a :: k). Show (f a) => Step f a -> String
showList :: [Step f a] -> ShowS
$cshowList :: forall k (f :: k -> *) (a :: k). Show (f a) => [Step f a] -> ShowS
show :: Step f a -> String
$cshow :: forall k (f :: k -> *) (a :: k). Show (f a) => Step f a -> String
showsPrec :: Int -> Step f a -> ShowS
$cshowsPrec :: forall k (f :: k -> *) (a :: k).
Show (f a) =>
Int -> Step f a -> ShowS
Show, ReadPrec [Step f a]
ReadPrec (Step f a)
ReadS [Step f a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec [Step f a]
forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec (Step f a)
forall k (f :: k -> *) (a :: k).
Read (f a) =>
Int -> ReadS (Step f a)
forall k (f :: k -> *) (a :: k). Read (f a) => ReadS [Step f a]
readListPrec :: ReadPrec [Step f a]
$creadListPrec :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec [Step f a]
readPrec :: ReadPrec (Step f a)
$creadPrec :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec (Step f a)
readList :: ReadS [Step f a]
$creadList :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadS [Step f a]
readsPrec :: Int -> ReadS (Step f a)
$creadsPrec :: forall k (f :: k -> *) (a :: k).
Read (f a) =>
Int -> ReadS (Step f a)
Read, Step f a -> Step f a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Step f a -> Step f a -> Bool
/= :: Step f a -> Step f a -> Bool
$c/= :: forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Step f a -> Step f a -> Bool
== :: Step f a -> Step f a -> Bool
$c== :: forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Step f a -> Step f a -> Bool
Eq, Step f a -> Step f a -> Bool
Step f a -> Step f a -> Ordering
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 {k} {f :: k -> *} {a :: k}. Ord (f a) => Eq (Step f a)
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Bool
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Ordering
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Step f a
min :: Step f a -> Step f a -> Step f a
$cmin :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Step f a
max :: Step f a -> Step f a -> Step f a
$cmax :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Step f a
>= :: Step f a -> Step f a -> Bool
$c>= :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Bool
> :: Step f a -> Step f a -> Bool
$c> :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Bool
<= :: Step f a -> Step f a -> Bool
$c<= :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Bool
< :: Step f a -> Step f a -> Bool
$c< :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Bool
compare :: Step f a -> Step f a -> Ordering
$ccompare :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Step f a -> Step f a -> Ordering
Ord, forall a b. a -> Step f b -> Step f a
forall a b. (a -> b) -> Step f a -> Step f b
forall (f :: * -> *) a b. Functor f => a -> Step f b -> Step f a
forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Step f a -> Step f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Step f b -> Step f a
$c<$ :: forall (f :: * -> *) a b. Functor f => a -> Step f b -> Step f a
fmap :: forall a b. (a -> b) -> Step f a -> Step f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Step f a -> Step f b
Functor, forall a. Step f a -> Bool
forall m a. Monoid m => (a -> m) -> Step f a -> m
forall a b. (a -> b -> b) -> b -> Step f a -> b
forall (f :: * -> *) a. (Foldable f, Eq a) => a -> Step f a -> Bool
forall (f :: * -> *) a. (Foldable f, Num a) => Step f a -> a
forall (f :: * -> *) a. (Foldable f, Ord a) => Step f a -> a
forall (f :: * -> *) m. (Foldable f, Monoid m) => Step f m -> m
forall (f :: * -> *) a. Foldable f => Step f a -> Bool
forall (f :: * -> *) a. Foldable f => Step f a -> Int
forall (f :: * -> *) a. Foldable f => Step f a -> [a]
forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Step f a -> a
forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Step f a -> m
forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Step f a -> b
forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Step f a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Step f a -> a
$cproduct :: forall (f :: * -> *) a. (Foldable f, Num a) => Step f a -> a
sum :: forall a. Num a => Step f a -> a
$csum :: forall (f :: * -> *) a. (Foldable f, Num a) => Step f a -> a
minimum :: forall a. Ord a => Step f a -> a
$cminimum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Step f a -> a
maximum :: forall a. Ord a => Step f a -> a
$cmaximum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Step f a -> a
elem :: forall a. Eq a => a -> Step f a -> Bool
$celem :: forall (f :: * -> *) a. (Foldable f, Eq a) => a -> Step f a -> Bool
length :: forall a. Step f a -> Int
$clength :: forall (f :: * -> *) a. Foldable f => Step f a -> Int
null :: forall a. Step f a -> Bool
$cnull :: forall (f :: * -> *) a. Foldable f => Step f a -> Bool
toList :: forall a. Step f a -> [a]
$ctoList :: forall (f :: * -> *) a. Foldable f => Step f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Step f a -> a
$cfoldl1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Step f a -> a
foldr1 :: forall a. (a -> a -> a) -> Step f a -> a
$cfoldr1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Step f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Step f a -> b
$cfoldl' :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Step f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Step f a -> b
$cfoldl :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Step f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Step f a -> b
$cfoldr' :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Step f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Step f a -> b
$cfoldr :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Step f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Step f a -> m
$cfoldMap' :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Step f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Step f a -> m
$cfoldMap :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Step f a -> m
fold :: forall m. Monoid m => Step f m -> m
$cfold :: forall (f :: * -> *) m. (Foldable f, Monoid m) => Step f m -> m
Foldable, 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 {f :: * -> *}. Traversable f => Functor (Step f)
forall {f :: * -> *}. Traversable f => Foldable (Step f)
forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Step f (m a) -> m (Step f a)
forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Step f (f a) -> f (Step f a)
forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Step f a -> m (Step f b)
forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Step f a -> f (Step f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Step f a -> f (Step f b)
sequence :: forall (m :: * -> *) a. Monad m => Step f (m a) -> m (Step f a)
$csequence :: forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Step f (m a) -> m (Step f a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Step f a -> m (Step f b)
$cmapM :: forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Step f a -> m (Step f b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Step f (f a) -> f (Step f a)
$csequenceA :: forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Step f (f a) -> f (Step f a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Step f a -> f (Step f b)
$ctraverse :: forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Step f a -> f (Step f b)
Traversable, Typeable, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k -> *) (a :: k) x. Rep (Step f a) x -> Step f a
forall k (f :: k -> *) (a :: k) x. Step f a -> Rep (Step f a) x
$cto :: forall k (f :: k -> *) (a :: k) x. Rep (Step f a) x -> Step f a
$cfrom :: forall k (f :: k -> *) (a :: k) x. Step f a -> Rep (Step f a) x
Generic, Step f a -> DataType
Step f a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {k} {f :: k -> *} {a :: k}.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Typeable (Step f a)
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Step f a -> DataType
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Step f a -> Constr
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b. Data b => b -> b) -> Step f a -> Step f a
forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Step f a -> u
forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d. Data d => d -> u) -> Step f a -> [u]
forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Step f a -> r
forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Step f a -> r
forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Step f a)
forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Step f a -> c (Step f a)
forall k (f :: k -> *) (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Step f a))
forall k (f :: k -> *) (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Step f a))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Step f a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Step f a -> c (Step f a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
$cgmapMo :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
$cgmapMp :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
$cgmapM :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Step f a -> m (Step f a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Step f a -> u
$cgmapQi :: forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Step f a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Step f a -> [u]
$cgmapQ :: forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d. Data d => d -> u) -> Step f a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Step f a -> r
$cgmapQr :: forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Step f a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Step f a -> r
$cgmapQl :: forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Step f a -> r
gmapT :: (forall b. Data b => b -> b) -> Step f a -> Step f a
$cgmapT :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b. Data b => b -> b) -> Step f a -> Step f a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Step f a))
$cdataCast2 :: forall k (f :: k -> *) (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Step f a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Step f a))
$cdataCast1 :: forall k (f :: k -> *) (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Step f a))
dataTypeOf :: Step f a -> DataType
$cdataTypeOf :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Step f a -> DataType
toConstr :: Step f a -> Constr
$ctoConstr :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Step f a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Step f a)
$cgunfold :: forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Step f a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Step f a -> c (Step f a)
$cgfoldl :: forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Step f a -> c (Step f a)
Data)

deriveShow1 ''Step
deriveRead1 ''Step
deriveEq1 ''Step
deriveOrd1 ''Step

-- | @since 0.3.0.0
instance Apply f => Apply (Step f) where
    Step Natural
n f (a -> b)
f <.> :: forall a b. Step f (a -> b) -> Step f a -> Step f b
<.> Step Natural
m f a
x = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
m) (f (a -> b)
f forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> f a
x)

instance Applicative f => Applicative (Step f) where
    pure :: forall a. a -> Step f a
pure = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Applicative f => a -> f a
pure
    Step Natural
n f (a -> b)
f <*> :: forall a b. Step f (a -> b) -> Step f a -> Step f b
<*> Step Natural
m f a
x = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
m) (f (a -> b)
f forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f a
x)

-- | @since 0.3.0.0
instance Contravariant f => Contravariant (Step f) where
    contramap :: forall a' a. (a' -> a) -> Step f a -> Step f a'
contramap a' -> a
f (Step Natural
x f a
y) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
x (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap a' -> a
f f a
y)

-- | @since 0.3.0.0
instance Divisible f => Divisible (Step f) where
    divide :: forall a b c. (a -> (b, c)) -> Step f b -> Step f c -> Step f a
divide a -> (b, c)
f (Step Natural
n f b
x) (Step Natural
m f c
y) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
m) (forall (f :: * -> *) a b c.
Divisible f =>
(a -> (b, c)) -> f b -> f c -> f a
divide a -> (b, c)
f f b
x f c
y)
    conquer :: forall a. Step f a
conquer = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0 forall (f :: * -> *) a. Divisible f => f a
conquer
-- | @since 0.3.0.0
instance Divise f => Divise (Step f) where
    divise :: forall a b c. (a -> (b, c)) -> Step f b -> Step f c -> Step f a
divise a -> (b, c)
f (Step Natural
n f b
x) (Step Natural
m f c
y) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
m) (forall (f :: * -> *) a b c.
Divise f =>
(a -> (b, c)) -> f b -> f c -> f a
divise a -> (b, c)
f f b
x f c
y)

-- | @since 0.3.0.0
instance Decide f => Decide (Step f) where
    decide :: forall a b c. (a -> Either b c) -> Step f b -> Step f c -> Step f a
decide a -> Either b c
f (Step Natural
n f b
x) (Step Natural
m f c
y) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
m) (forall (f :: * -> *) a b c.
Decide f =>
(a -> Either b c) -> f b -> f c -> f a
decide a -> Either b c
f f b
x f c
y)
-- | @since 0.3.0.0
instance Conclude f => Conclude (Step f) where
    conclude :: forall a. (a -> Void) -> Step f a
conclude = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Conclude f => (a -> Void) -> f a
conclude
-- | @since 0.3.0.0
instance Decidable f => Decidable (Step f) where
    choose :: forall a b c. (a -> Either b c) -> Step f b -> Step f c -> Step f a
choose a -> Either b c
f (Step Natural
n f b
x) (Step Natural
m f c
y) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
m) (forall (f :: * -> *) a b c.
Decidable f =>
(a -> Either b c) -> f b -> f c -> f a
choose a -> Either b c
f f b
x f c
y)
    lose :: forall a. (a -> Void) -> Step f a
lose = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Decidable f => (a -> Void) -> f a
lose

-- | @since 0.3.0.0
instance Invariant f => Invariant (Step f) where
    invmap :: forall a b. (a -> b) -> (b -> a) -> Step f a -> Step f b
invmap a -> b
f b -> a
g (Step Natural
x f a
y) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
x (forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g f a
y)

instance Pointed f => Pointed (Step f) where
    point :: forall a. a -> Step f a
point = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> *) a. Pointed p => a -> p a
point

instance Foldable1 f => Foldable1 (Step f) where
    fold1 :: forall m. Semigroup m => Step f m -> m
fold1      = forall (t :: * -> *) m. (Foldable1 t, Semigroup m) => t m -> m
fold1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Step f a -> f a
stepVal
    foldMap1 :: forall m a. Semigroup m => (a -> m) -> Step f a -> m
foldMap1 a -> m
f = forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1 a -> m
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Step f a -> f a
stepVal
    toNonEmpty :: forall a. Step f a -> NonEmpty a
toNonEmpty = forall (t :: * -> *) a. Foldable1 t => t a -> NonEmpty a
toNonEmpty forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Step f a -> f a
stepVal

instance Traversable1 f => Traversable1 (Step f) where
    traverse1 :: forall (f :: * -> *) a b.
Apply f =>
(a -> f b) -> Step f a -> f (Step f b)
traverse1 a -> f b
f (Step Natural
n f a
x) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
traverse1 a -> f b
f f a
x
    sequence1 :: forall (f :: * -> *) b. Apply f => Step f (f b) -> f (Step f b)
sequence1 (Step Natural
n f (f b)
x) = forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) b.
(Traversable1 t, Apply f) =>
t (f b) -> f (t b)
sequence1 f (f b)
x

-- | "Uncons and cons" an @f@ branch before a 'Step'.  This is basically
-- a witness that 'stepDown' and 'stepUp' form an isomorphism.
stepping :: Step f <~> f :+: Step f
stepping :: forall {k} (f :: k -> *). Step f <~> (f :+: Step f)
stepping = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp

-- | Pop off the first item in a 'Step'.  Because a @'Step' f@ is @f :+:
-- f :+: f :+: ...@ forever, this matches on the first branch.
--
-- You can think of it as reassociating
--
-- @
-- f :+: f :+: f :+: f :+: ...
-- @
--
-- into
--
-- @
-- f :+: ( f :+: f :+: f :+: ...)
-- @
--
-- @
-- 'stepDown' ('Step' 2 "hello")
-- -- 'R1' (Step 1 "hello")
-- stepDown (Step 0 "hello")
-- -- 'L1' "hello"
-- @
--
-- Forms an isomorphism with 'stepUp' (see 'stepping').
stepDown :: Step f ~> f :+: Step f
stepDown :: forall {k} (f :: k -> *). Step f ~> (f :+: Step f)
stepDown (Step Natural
n f x
x) = case Natural -> Natural -> Maybe Natural
minusNaturalMaybe Natural
n Natural
1 of
    Maybe Natural
Nothing -> forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
    Just Natural
m  -> forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
m f x
x)

-- | Unshift an item into a 'Step'.  Because a @'Step' f@ is @f :+: f :+:
-- f :+: f :+: ...@ forever, this basically conses an additional
-- possibility of @f@ to the beginning of it all.
--
-- You can think of it as reassociating
--
-- @
-- f :+: ( f :+: f :+: f :+: ...)
-- @
--
-- into
--
-- @
-- f :+: f :+: f :+: f :+: ...
-- @
--
-- @
-- 'stepUp' ('L1' "hello")
-- -- 'Step' 0 "hello"
-- stepUp ('R1' (Step 1 "hello"))
-- -- Step 2 "hello"
-- @
--
-- Forms an isomorphism with 'stepDown' (see 'stepping').
stepUp :: f :+: Step f ~> Step f
stepUp :: forall {k} (f :: k -> *). (f :+: Step f) ~> Step f
stepUp = \case
    L1 f x
x          -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
0       f x
x
    R1 (Step Natural
n f x
y) -> forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step (Natural
n forall a. Num a => a -> a -> a
+ Natural
1) f x
y

-- | We have a natural transformation between 'V1' and any other
-- functor @f@ with no constraints.
absurd1 :: V1 a -> f a
absurd1 :: forall {k} (a :: k) (f :: k -> *). V1 a -> f a
absurd1 = \case {}

-- | A non-empty map of 'Natural' to @f a@.  Basically, contains multiple
-- @f a@s, each at a given 'Natural' index.
--
-- @
-- Steps f a ~ 'M.Map' 'Natural' (f a)
-- Steps f   ~ 'M.Map' 'Natural' ':.:' f       -- functor composition
-- @
--
-- It is the fixed point of applications of 'Data.Functor.These.TheseT'.
--
-- You can think of this as an infinite sparse array of @f a@s.
--
-- Intuitively, in an infinite @f \`TheseT\` f \`TheseT\` f \`TheseT\` f ...@,
-- each of those infinite positions may have an @f@ in them.  However,
-- because of the at-least-one nature of 'Data.Functor.These.TheseT', we know we have at least
-- one f at one position /somewhere/.
--
-- A @'Steps' f a@ has potentially many @f@s, each stored at a different
-- 'Natural' position, with the guaruntee that at least one @f@ exists.
--
-- Can be useful for using with the 'Data.HBifunctor.Tensor.Monoidal' instance
-- of 'Data.Functor.These.TheseT'.
--
-- 'Data.HFunctor.interpret'ing it requires at least an 'Alt'
-- instance in the target context, since we have to handle potentially more
-- than one @f@.
--
-- This type is essentailly the same as @'Control.Applicative.ListF.NEMapF'
-- ('Sum' 'Natural')@ (except with a different 'Semigroup' instance).
newtype Steps f a = Steps { forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps :: NEMap Natural (f a) }
  deriving (Int -> Steps f a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k -> *) (a :: k).
Show (f a) =>
Int -> Steps f a -> ShowS
forall k (f :: k -> *) (a :: k). Show (f a) => [Steps f a] -> ShowS
forall k (f :: k -> *) (a :: k). Show (f a) => Steps f a -> String
showList :: [Steps f a] -> ShowS
$cshowList :: forall k (f :: k -> *) (a :: k). Show (f a) => [Steps f a] -> ShowS
show :: Steps f a -> String
$cshow :: forall k (f :: k -> *) (a :: k). Show (f a) => Steps f a -> String
showsPrec :: Int -> Steps f a -> ShowS
$cshowsPrec :: forall k (f :: k -> *) (a :: k).
Show (f a) =>
Int -> Steps f a -> ShowS
Show, ReadPrec [Steps f a]
ReadPrec (Steps f a)
ReadS [Steps f a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec [Steps f a]
forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec (Steps f a)
forall k (f :: k -> *) (a :: k).
Read (f a) =>
Int -> ReadS (Steps f a)
forall k (f :: k -> *) (a :: k). Read (f a) => ReadS [Steps f a]
readListPrec :: ReadPrec [Steps f a]
$creadListPrec :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec [Steps f a]
readPrec :: ReadPrec (Steps f a)
$creadPrec :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadPrec (Steps f a)
readList :: ReadS [Steps f a]
$creadList :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadS [Steps f a]
readsPrec :: Int -> ReadS (Steps f a)
$creadsPrec :: forall k (f :: k -> *) (a :: k).
Read (f a) =>
Int -> ReadS (Steps f a)
Read, Steps f a -> Steps f a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Steps f a -> Steps f a -> Bool
/= :: Steps f a -> Steps f a -> Bool
$c/= :: forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Steps f a -> Steps f a -> Bool
== :: Steps f a -> Steps f a -> Bool
$c== :: forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Steps f a -> Steps f a -> Bool
Eq, Steps f a -> Steps f a -> Bool
Steps f a -> Steps f a -> Ordering
Steps f a -> Steps f a -> Steps f a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {f :: k -> *} {a :: k}. Ord (f a) => Eq (Steps f a)
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Bool
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Ordering
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Steps f a
min :: Steps f a -> Steps f a -> Steps f a
$cmin :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Steps f a
max :: Steps f a -> Steps f a -> Steps f a
$cmax :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Steps f a
>= :: Steps f a -> Steps f a -> Bool
$c>= :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Bool
> :: Steps f a -> Steps f a -> Bool
$c> :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Bool
<= :: Steps f a -> Steps f a -> Bool
$c<= :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Bool
< :: Steps f a -> Steps f a -> Bool
$c< :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Bool
compare :: Steps f a -> Steps f a -> Ordering
$ccompare :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Steps f a -> Steps f a -> Ordering
Ord, forall a b. a -> Steps f b -> Steps f a
forall a b. (a -> b) -> Steps f a -> Steps f b
forall (f :: * -> *) a b. Functor f => a -> Steps f b -> Steps f a
forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Steps f a -> Steps f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Steps f b -> Steps f a
$c<$ :: forall (f :: * -> *) a b. Functor f => a -> Steps f b -> Steps f a
fmap :: forall a b. (a -> b) -> Steps f a -> Steps f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Steps f a -> Steps f b
Functor, forall a. Steps f a -> Bool
forall m a. Monoid m => (a -> m) -> Steps f a -> m
forall a b. (a -> b -> b) -> b -> Steps f a -> b
forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Steps f a -> Bool
forall (f :: * -> *) a. (Foldable f, Num a) => Steps f a -> a
forall (f :: * -> *) a. (Foldable f, Ord a) => Steps f a -> a
forall (f :: * -> *) m. (Foldable f, Monoid m) => Steps f m -> m
forall (f :: * -> *) a. Foldable f => Steps f a -> Bool
forall (f :: * -> *) a. Foldable f => Steps f a -> Int
forall (f :: * -> *) a. Foldable f => Steps f a -> [a]
forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Steps f a -> a
forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Steps f a -> m
forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Steps f a -> b
forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Steps f a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Steps f a -> a
$cproduct :: forall (f :: * -> *) a. (Foldable f, Num a) => Steps f a -> a
sum :: forall a. Num a => Steps f a -> a
$csum :: forall (f :: * -> *) a. (Foldable f, Num a) => Steps f a -> a
minimum :: forall a. Ord a => Steps f a -> a
$cminimum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Steps f a -> a
maximum :: forall a. Ord a => Steps f a -> a
$cmaximum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Steps f a -> a
elem :: forall a. Eq a => a -> Steps f a -> Bool
$celem :: forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Steps f a -> Bool
length :: forall a. Steps f a -> Int
$clength :: forall (f :: * -> *) a. Foldable f => Steps f a -> Int
null :: forall a. Steps f a -> Bool
$cnull :: forall (f :: * -> *) a. Foldable f => Steps f a -> Bool
toList :: forall a. Steps f a -> [a]
$ctoList :: forall (f :: * -> *) a. Foldable f => Steps f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Steps f a -> a
$cfoldl1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Steps f a -> a
foldr1 :: forall a. (a -> a -> a) -> Steps f a -> a
$cfoldr1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Steps f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Steps f a -> b
$cfoldl' :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Steps f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Steps f a -> b
$cfoldl :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Steps f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Steps f a -> b
$cfoldr' :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Steps f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Steps f a -> b
$cfoldr :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Steps f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Steps f a -> m
$cfoldMap' :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Steps f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Steps f a -> m
$cfoldMap :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Steps f a -> m
fold :: forall m. Monoid m => Steps f m -> m
$cfold :: forall (f :: * -> *) m. (Foldable f, Monoid m) => Steps f m -> m
Foldable, 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 {f :: * -> *}. Traversable f => Functor (Steps f)
forall {f :: * -> *}. Traversable f => Foldable (Steps f)
forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Steps f (m a) -> m (Steps f a)
forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Steps f (f a) -> f (Steps f a)
forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Steps f a -> m (Steps f b)
forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Steps f a -> f (Steps f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Steps f a -> f (Steps f b)
sequence :: forall (m :: * -> *) a. Monad m => Steps f (m a) -> m (Steps f a)
$csequence :: forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Steps f (m a) -> m (Steps f a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Steps f a -> m (Steps f b)
$cmapM :: forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Steps f a -> m (Steps f b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Steps f (f a) -> f (Steps f a)
$csequenceA :: forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Steps f (f a) -> f (Steps f a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Steps f a -> f (Steps f b)
$ctraverse :: forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Steps f a -> f (Steps f b)
Traversable, Typeable, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k -> *) (a :: k) x. Rep (Steps f a) x -> Steps f a
forall k (f :: k -> *) (a :: k) x. Steps f a -> Rep (Steps f a) x
$cto :: forall k (f :: k -> *) (a :: k) x. Rep (Steps f a) x -> Steps f a
$cfrom :: forall k (f :: k -> *) (a :: k) x. Steps f a -> Rep (Steps f a) x
Generic, Steps f a -> DataType
Steps f a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {k} {f :: k -> *} {a :: k}.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Typeable (Steps f a)
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Steps f a -> DataType
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Steps f a -> Constr
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b. Data b => b -> b) -> Steps f a -> Steps f a
forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Steps f a -> u
forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d. Data d => d -> u) -> Steps f a -> [u]
forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Steps f a -> r
forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Steps f a -> r
forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Steps f a)
forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Steps f a -> c (Steps f a)
forall k (f :: k -> *) (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Steps f a))
forall k (f :: k -> *) (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Steps f a))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Steps f a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Steps f a -> c (Steps f a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
$cgmapMo :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
$cgmapMp :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
$cgmapM :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Steps f a -> m (Steps f a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Steps f a -> u
$cgmapQi :: forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Steps f a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Steps f a -> [u]
$cgmapQ :: forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d. Data d => d -> u) -> Steps f a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Steps f a -> r
$cgmapQr :: forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Steps f a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Steps f a -> r
$cgmapQl :: forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Steps f a -> r
gmapT :: (forall b. Data b => b -> b) -> Steps f a -> Steps f a
$cgmapT :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b. Data b => b -> b) -> Steps f a -> Steps f a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Steps f a))
$cdataCast2 :: forall k (f :: k -> *) (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Steps f a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Steps f a))
$cdataCast1 :: forall k (f :: k -> *) (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Steps f a))
dataTypeOf :: Steps f a -> DataType
$cdataTypeOf :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Steps f a -> DataType
toConstr :: Steps f a -> Constr
$ctoConstr :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Steps f a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Steps f a)
$cgunfold :: forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Steps f a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Steps f a -> c (Steps f a)
$cgfoldl :: forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Steps f a -> c (Steps f a)
Data)

deriveShow1 ''Steps
deriveRead1 ''Steps
deriveEq1 ''Steps
deriveOrd1 ''Steps

instance Foldable1 f => Foldable1 (Steps f) where
    fold1 :: forall m. Semigroup m => Steps f m -> m
fold1      = forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1 forall (t :: * -> *) m. (Foldable1 t, Semigroup m) => t m -> m
fold1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps
    foldMap1 :: forall m a. Semigroup m => (a -> m) -> Steps f a -> m
foldMap1 a -> m
f = (forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1) a -> m
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps
    toNonEmpty :: forall a. Steps f a -> NonEmpty a
toNonEmpty = forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1 forall (t :: * -> *) a. Foldable1 t => t a -> NonEmpty a
toNonEmpty forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps

instance Traversable1 f => Traversable1 (Steps f) where
    traverse1 :: forall (f :: * -> *) a b.
Apply f =>
(a -> f b) -> Steps f a -> f (Steps f b)
traverse1 a -> f b
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
traverse1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
traverse1) a -> f b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps
    sequence1 :: forall (f :: * -> *) b. Apply f => Steps f (f b) -> f (Steps f b)
sequence1   = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
traverse1 forall (t :: * -> *) (f :: * -> *) b.
(Traversable1 t, Apply f) =>
t (f b) -> f (t b)
sequence1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps

-- | Appends the items back-to-back, shifting all of the items in the
-- second map.  Matches the behavior as the fixed-point of 'These1'.
instance Semigroup (Steps f a) where
    Steps NEMap Natural (f a)
xs <> :: Steps f a -> Steps f a -> Steps f a
<> Steps NEMap Natural (f a)
ys = forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall a b. (a -> b) -> a -> b
$
      let (Natural
k, f a
_) = forall k a. NEMap k a -> (k, a)
NEM.findMax NEMap Natural (f a)
xs
      in  NEMap Natural (f a)
xs forall a. Semigroup a => a -> a -> a
<> forall k1 k2 a. (k1 -> k2) -> NEMap k1 a -> NEMap k2 a
NEM.mapKeysMonotonic (forall a. Num a => a -> a -> a
+ (Natural
k forall a. Num a => a -> a -> a
+ Natural
1)) NEMap Natural (f a)
ys

-- | @since 0.3.0.0
instance Contravariant f => Contravariant (Steps f) where
    contramap :: forall a' a. (a' -> a) -> Steps f a -> Steps f a'
contramap a' -> a
f (Steps NEMap Natural (f a)
xs) = forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps ((forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
contramap) a' -> a
f NEMap Natural (f a)
xs)

-- TODO: consider what Divisible/Decidable should be.  Maybe no need to
-- rush into this.

-- | @since 0.3.0.0
instance Invariant f => Invariant (Steps f) where
    invmap :: forall a b. (a -> b) -> (b -> a) -> Steps f a -> Steps f b
invmap a -> b
f b -> a
g (Steps NEMap Natural (f a)
xs) = forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (f :: * -> *) a b.
Invariant f =>
(a -> b) -> (b -> a) -> f a -> f b
invmap a -> b
f b -> a
g) NEMap Natural (f a)
xs)


-- | Left-biased untion
instance Functor f => Alt (Steps f) where
    Steps NEMap Natural (f a)
xs <!> :: forall a. Steps f a -> Steps f a -> Steps f a
<!> Steps NEMap Natural (f a)
ys = forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall a b. (a -> b) -> a -> b
$ forall k a. Ord k => NEMap k a -> NEMap k a -> NEMap k a
NEM.union NEMap Natural (f a)
xs NEMap Natural (f a)
ys

instance Pointed f => Pointed (Steps f) where
    point :: forall a. a -> Steps f a
point = forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. k -> a -> NEMap k a
NEM.singleton Natural
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> *) a. Pointed p => a -> p a
point

-- | "Uncons and cons" an @f@ branch before a 'Steps'.  This is basically
-- a witness that 'stepsDown' and 'stepsUp' form an isomorphism.
steppings :: Steps f <~> These1 f (Steps f)
steppings :: forall (f :: * -> *). Steps f <~> These1 f (Steps f)
steppings = forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF forall (f :: * -> *). Steps f ~> These1 f (Steps f)
stepsDown forall (f :: * -> *). These1 f (Steps f) ~> Steps f
stepsUp

-- | Pop off the first item in a 'Steps'.  Because a @'Steps' f@ is @f
-- `These1` f `These1` f `These1` ...@ forever, this matches on the first branch.
--
-- You can think of it as reassociating
--
-- @
-- f `These1` f `These1` f `These1` f `These1` ...
-- @
--
-- into
--
-- @
-- f `These1` ( f `These1` f `These1` f `These1` ...)
-- @
--
-- It returns:
--
-- *  'This1' if the first item is the /only/ item in the 'Steps'
-- *  'That1' if the first item in the 'Steps' is empty, but there are more
--    items left.  The extra items are all shfited down.
-- *  'These1' if the first item in the 'Steps' exists, and there are also
--    more items left.  The extra items are all shifted down.
--
-- Forms an isomorphism with 'stepsUp' (see 'steppings').
stepsDown :: Steps f ~> These1 f (Steps f)
stepsDown :: forall (f :: * -> *). Steps f ~> These1 f (Steps f)
stepsDown = forall a c b.
(a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c
these forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1 forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1 forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1
          forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap forall a. First a -> a
getFirst forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps
          forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m k a. Semigroup m => (k -> a -> m) -> NEMap k a -> m
NEM.foldMapWithKey forall {k} (f :: k -> *) (a :: k).
Natural -> f a -> These (First (f a)) (NEMap Natural (f a))
decr
          forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps

decr :: Natural -> f a -> These (First (f a)) (NEMap Natural (f a))
decr :: forall {k} (f :: k -> *) (a :: k).
Natural -> f a -> These (First (f a)) (NEMap Natural (f a))
decr Natural
i f a
x = case Natural -> Natural -> Maybe Natural
minusNaturalMaybe Natural
i Natural
1 of
      Maybe Natural
Nothing -> forall a b. a -> These a b
This forall a b. (a -> b) -> a -> b
$ forall a. a -> First a
First f a
x
      Just Natural
i' -> forall a b. b -> These a b
That forall a b. (a -> b) -> a -> b
$ forall k a. k -> a -> NEMap k a
NEM.singleton Natural
i' f a
x

-- | Unshift an item into a 'Steps'.  Because a @'Steps' f@ is @f `These1`
-- f `These1` f `These1` f `These1` ...@ forever, this basically conses an
-- additional possibility of @f@ to the beginning of it all.
--
-- You can think of it as reassociating
--
-- @
-- f `These1` ( f `These1` f `These1` f `These1` ...)
-- @
--
-- into
--
-- @
-- f `These1` f `These1` f `These1` f `These1` ...
-- @
--
-- If you give:
--
-- *  'This1', then it returns a singleton 'Steps' with one item at
--    index 0
-- *  'That1', then it shifts every item in the given 'Steps' up one
--    index.
-- *  'These1', then it shifts every item in the given 'Steps' up one
--    index, and adds the given item (the @f@) at index zero.
--
-- Forms an isomorphism with 'stepDown' (see 'stepping').
stepsUp :: These1 f (Steps f) ~> Steps f
stepsUp :: forall (f :: * -> *). These1 f (Steps f) ~> Steps f
stepsUp = \case
    This1  f x
x    -> forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall a b. (a -> b) -> a -> b
$ forall k a. k -> a -> NEMap k a
NEM.singleton Natural
0 f x
x
    That1    Steps f x
xs -> forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k1 k2 a. (k1 -> k2) -> NEMap k1 a -> NEMap k2 a
NEM.mapKeysMonotonic (forall a. Num a => a -> a -> a
+ Natural
1)
                         forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps
                         forall a b. (a -> b) -> a -> b
$ Steps f x
xs
    These1 f x
x Steps f x
xs -> forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. k -> a -> Map k a -> NEMap k a
NEM.insertMapMin Natural
0 f x
x
                         forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k a. NEMap k a -> Map k a
NEM.toMap
                         forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k1 k2 a. (k1 -> k2) -> NEMap k1 a -> NEMap k2 a
NEM.mapKeysMonotonic (forall a. Num a => a -> a -> a
+ Natural
1)
                         forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Steps f a -> NEMap Natural (f a)
getSteps
                         forall a b. (a -> b) -> a -> b
$ Steps f x
xs


-- | An @f a@, along with a 'Bool' flag
--
-- @
-- 'Flagged' f a ~ ('Bool', f a)
-- Flagged f   ~ ((,) Bool) ':.:' f       -- functor composition
-- @
--
-- Creation with 'Data.HFunctor.inject' or 'pure' uses 'False' as the
-- boolean.
--
-- You can think of it as an @f a@ that is "flagged" with a boolean value,
-- and that value can indicuate whether or not it is "pure" (made with
-- 'Data.HFunctor.inject' or 'pure') as 'False', or "impure"
-- (made from some other source) as 'True'.  However, 'False' may be always
-- created directly, of course, using the constructor.
--
-- You can think of it like a 'Step' that is either 0 or 1, as well.
--
-- 'Data.HFunctor.Interpret.interpret'ing it requires no constraint on the
-- target context.
--
-- This type is equivalent (along with its instances) to:
--
-- *   @'Data.HFunctor.HLift' 'Control.Monad.Trans.Identity.IdentityT'@
-- *   @'Control.COmonad.Trans.Env.EnvT' 'Data.Semigroup.Any'@
data Flagged f a = Flagged { forall {k} (f :: k -> *) (a :: k). Flagged f a -> Bool
flaggedFlag :: Bool, forall {k} (f :: k -> *) (a :: k). Flagged f a -> f a
flaggedVal :: f a }
  deriving (Int -> Flagged f a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k -> *) (a :: k).
Show (f a) =>
Int -> Flagged f a -> ShowS
forall k (f :: k -> *) (a :: k).
Show (f a) =>
[Flagged f a] -> ShowS
forall k (f :: k -> *) (a :: k).
Show (f a) =>
Flagged f a -> String
showList :: [Flagged f a] -> ShowS
$cshowList :: forall k (f :: k -> *) (a :: k).
Show (f a) =>
[Flagged f a] -> ShowS
show :: Flagged f a -> String
$cshow :: forall k (f :: k -> *) (a :: k).
Show (f a) =>
Flagged f a -> String
showsPrec :: Int -> Flagged f a -> ShowS
$cshowsPrec :: forall k (f :: k -> *) (a :: k).
Show (f a) =>
Int -> Flagged f a -> ShowS
Show, ReadPrec [Flagged f a]
ReadPrec (Flagged f a)
ReadS [Flagged f a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k -> *) (a :: k).
Read (f a) =>
ReadPrec [Flagged f a]
forall k (f :: k -> *) (a :: k).
Read (f a) =>
ReadPrec (Flagged f a)
forall k (f :: k -> *) (a :: k).
Read (f a) =>
Int -> ReadS (Flagged f a)
forall k (f :: k -> *) (a :: k). Read (f a) => ReadS [Flagged f a]
readListPrec :: ReadPrec [Flagged f a]
$creadListPrec :: forall k (f :: k -> *) (a :: k).
Read (f a) =>
ReadPrec [Flagged f a]
readPrec :: ReadPrec (Flagged f a)
$creadPrec :: forall k (f :: k -> *) (a :: k).
Read (f a) =>
ReadPrec (Flagged f a)
readList :: ReadS [Flagged f a]
$creadList :: forall k (f :: k -> *) (a :: k). Read (f a) => ReadS [Flagged f a]
readsPrec :: Int -> ReadS (Flagged f a)
$creadsPrec :: forall k (f :: k -> *) (a :: k).
Read (f a) =>
Int -> ReadS (Flagged f a)
Read, Flagged f a -> Flagged f a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Flagged f a -> Flagged f a -> Bool
/= :: Flagged f a -> Flagged f a -> Bool
$c/= :: forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Flagged f a -> Flagged f a -> Bool
== :: Flagged f a -> Flagged f a -> Bool
$c== :: forall k (f :: k -> *) (a :: k).
Eq (f a) =>
Flagged f a -> Flagged f a -> Bool
Eq, Flagged f a -> Flagged f a -> Bool
Flagged f a -> Flagged f a -> Ordering
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 {k} {f :: k -> *} {a :: k}. Ord (f a) => Eq (Flagged f a)
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Bool
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Ordering
forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Flagged f a
min :: Flagged f a -> Flagged f a -> Flagged f a
$cmin :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Flagged f a
max :: Flagged f a -> Flagged f a -> Flagged f a
$cmax :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Flagged f a
>= :: Flagged f a -> Flagged f a -> Bool
$c>= :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Bool
> :: Flagged f a -> Flagged f a -> Bool
$c> :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Bool
<= :: Flagged f a -> Flagged f a -> Bool
$c<= :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Bool
< :: Flagged f a -> Flagged f a -> Bool
$c< :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Bool
compare :: Flagged f a -> Flagged f a -> Ordering
$ccompare :: forall k (f :: k -> *) (a :: k).
Ord (f a) =>
Flagged f a -> Flagged f a -> Ordering
Ord, forall a b. a -> Flagged f b -> Flagged f a
forall a b. (a -> b) -> Flagged f a -> Flagged f b
forall (f :: * -> *) a b.
Functor f =>
a -> Flagged f b -> Flagged f a
forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Flagged f a -> Flagged f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Flagged f b -> Flagged f a
$c<$ :: forall (f :: * -> *) a b.
Functor f =>
a -> Flagged f b -> Flagged f a
fmap :: forall a b. (a -> b) -> Flagged f a -> Flagged f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Flagged f a -> Flagged f b
Functor, forall a. Flagged f a -> Bool
forall m a. Monoid m => (a -> m) -> Flagged f a -> m
forall a b. (a -> b -> b) -> b -> Flagged f a -> b
forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Flagged f a -> Bool
forall (f :: * -> *) a. (Foldable f, Num a) => Flagged f a -> a
forall (f :: * -> *) a. (Foldable f, Ord a) => Flagged f a -> a
forall (f :: * -> *) m. (Foldable f, Monoid m) => Flagged f m -> m
forall (f :: * -> *) a. Foldable f => Flagged f a -> Bool
forall (f :: * -> *) a. Foldable f => Flagged f a -> Int
forall (f :: * -> *) a. Foldable f => Flagged f a -> [a]
forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Flagged f a -> a
forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Flagged f a -> m
forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Flagged f a -> b
forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Flagged f a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Flagged f a -> a
$cproduct :: forall (f :: * -> *) a. (Foldable f, Num a) => Flagged f a -> a
sum :: forall a. Num a => Flagged f a -> a
$csum :: forall (f :: * -> *) a. (Foldable f, Num a) => Flagged f a -> a
minimum :: forall a. Ord a => Flagged f a -> a
$cminimum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Flagged f a -> a
maximum :: forall a. Ord a => Flagged f a -> a
$cmaximum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Flagged f a -> a
elem :: forall a. Eq a => a -> Flagged f a -> Bool
$celem :: forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Flagged f a -> Bool
length :: forall a. Flagged f a -> Int
$clength :: forall (f :: * -> *) a. Foldable f => Flagged f a -> Int
null :: forall a. Flagged f a -> Bool
$cnull :: forall (f :: * -> *) a. Foldable f => Flagged f a -> Bool
toList :: forall a. Flagged f a -> [a]
$ctoList :: forall (f :: * -> *) a. Foldable f => Flagged f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Flagged f a -> a
$cfoldl1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Flagged f a -> a
foldr1 :: forall a. (a -> a -> a) -> Flagged f a -> a
$cfoldr1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Flagged f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Flagged f a -> b
$cfoldl' :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Flagged f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Flagged f a -> b
$cfoldl :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Flagged f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Flagged f a -> b
$cfoldr' :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Flagged f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Flagged f a -> b
$cfoldr :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Flagged f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Flagged f a -> m
$cfoldMap' :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Flagged f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Flagged f a -> m
$cfoldMap :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Flagged f a -> m
fold :: forall m. Monoid m => Flagged f m -> m
$cfold :: forall (f :: * -> *) m. (Foldable f, Monoid m) => Flagged f m -> m
Foldable, 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 {f :: * -> *}. Traversable f => Functor (Flagged f)
forall {f :: * -> *}. Traversable f => Foldable (Flagged f)
forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Flagged f (m a) -> m (Flagged f a)
forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Flagged f (f a) -> f (Flagged f a)
forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Flagged f a -> m (Flagged f b)
forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Flagged f a -> f (Flagged f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Flagged f a -> f (Flagged f b)
sequence :: forall (m :: * -> *) a.
Monad m =>
Flagged f (m a) -> m (Flagged f a)
$csequence :: forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Flagged f (m a) -> m (Flagged f a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Flagged f a -> m (Flagged f b)
$cmapM :: forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Flagged f a -> m (Flagged f b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Flagged f (f a) -> f (Flagged f a)
$csequenceA :: forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Flagged f (f a) -> f (Flagged f a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Flagged f a -> f (Flagged f b)
$ctraverse :: forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Flagged f a -> f (Flagged f b)
Traversable, Typeable, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k -> *) (a :: k) x.
Rep (Flagged f a) x -> Flagged f a
forall k (f :: k -> *) (a :: k) x.
Flagged f a -> Rep (Flagged f a) x
$cto :: forall k (f :: k -> *) (a :: k) x.
Rep (Flagged f a) x -> Flagged f a
$cfrom :: forall k (f :: k -> *) (a :: k) x.
Flagged f a -> Rep (Flagged f a) x
Generic, Flagged f a -> DataType
Flagged f a -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {k} {f :: k -> *} {a :: k}.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Typeable (Flagged f a)
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Flagged f a -> DataType
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Flagged f a -> Constr
forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b. Data b => b -> b) -> Flagged f a -> Flagged f a
forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Flagged f a -> u
forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d. Data d => d -> u) -> Flagged f a -> [u]
forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Flagged f a -> r
forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Flagged f a -> r
forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Flagged f a)
forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Flagged f a -> c (Flagged f a)
forall k (f :: k -> *) (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Flagged f a))
forall k (f :: k -> *) (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Flagged f a))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Flagged f a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Flagged f a -> c (Flagged f a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
$cgmapMo :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
$cgmapMp :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
$cgmapM :: forall k (f :: k -> *) (a :: k) (m :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Flagged f a -> m (Flagged f a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Flagged f a -> u
$cgmapQi :: forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Flagged f a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Flagged f a -> [u]
$cgmapQ :: forall k (f :: k -> *) (a :: k) u.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d. Data d => d -> u) -> Flagged f a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Flagged f a -> r
$cgmapQr :: forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Flagged f a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Flagged f a -> r
$cgmapQl :: forall k (f :: k -> *) (a :: k) r r'.
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Flagged f a -> r
gmapT :: (forall b. Data b => b -> b) -> Flagged f a -> Flagged f a
$cgmapT :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b. Data b => b -> b) -> Flagged f a -> Flagged f a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Flagged f a))
$cdataCast2 :: forall k (f :: k -> *) (a :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Flagged f a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Flagged f a))
$cdataCast1 :: forall k (f :: k -> *) (a :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Flagged f a))
dataTypeOf :: Flagged f a -> DataType
$cdataTypeOf :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Flagged f a -> DataType
toConstr :: Flagged f a -> Constr
$ctoConstr :: forall k (f :: k -> *) (a :: k).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
Flagged f a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Flagged f a)
$cgunfold :: forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Flagged f a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Flagged f a -> c (Flagged f a)
$cgfoldl :: forall k (f :: k -> *) (a :: k) (c :: * -> *).
(Typeable a, Typeable f, Typeable k, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Flagged f a -> c (Flagged f a)
Data)

deriveShow1 ''Flagged
deriveRead1 ''Flagged
deriveEq1 ''Flagged
deriveOrd1 ''Flagged

-- | Uses 'False' for 'pure', and '||' for '<*>'.
instance Applicative f => Applicative (Flagged f) where
    pure :: forall a. a -> Flagged f a
pure = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Applicative f => a -> f a
pure
    Flagged Bool
n f (a -> b)
f <*> :: forall a b. Flagged f (a -> b) -> Flagged f a -> Flagged f b
<*> Flagged Bool
m f a
x = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged (Bool
n Bool -> Bool -> Bool
|| Bool
m) (f (a -> b)
f forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f a
x)

-- | Uses 'False' for 'point'.
instance Pointed f => Pointed (Flagged f) where
    point :: forall a. a -> Flagged f a
point = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
False forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: * -> *) a. Pointed p => a -> p a
point

instance Foldable1 f => Foldable1 (Flagged f) where
    fold1 :: forall m. Semigroup m => Flagged f m -> m
fold1      = forall (t :: * -> *) m. (Foldable1 t, Semigroup m) => t m -> m
fold1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Flagged f a -> f a
flaggedVal
    foldMap1 :: forall m a. Semigroup m => (a -> m) -> Flagged f a -> m
foldMap1 a -> m
f = forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
foldMap1 a -> m
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Flagged f a -> f a
flaggedVal
    toNonEmpty :: forall a. Flagged f a -> NonEmpty a
toNonEmpty = forall (t :: * -> *) a. Foldable1 t => t a -> NonEmpty a
toNonEmpty forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) (a :: k). Flagged f a -> f a
flaggedVal

instance Traversable1 f => Traversable1 (Flagged f) where
    traverse1 :: forall (f :: * -> *) a b.
Apply f =>
(a -> f b) -> Flagged f a -> f (Flagged f b)
traverse1 a -> f b
f (Flagged Bool
n f a
x) = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
traverse1 a -> f b
f f a
x
    sequence1 :: forall (f :: * -> *) b.
Apply f =>
Flagged f (f b) -> f (Flagged f b)
sequence1 (Flagged Bool
n f (f b)
x) = forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
n forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (f :: * -> *) b.
(Traversable1 t, Apply f) =>
t (f b) -> f (t b)
sequence1 f (f b)
x





-- | @'Void2' a b@ is uninhabited for all @a@ and @b@.
data Void2 a b
  deriving (Int -> Void2 a b -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (a :: k) k (b :: k). Int -> Void2 a b -> ShowS
forall k (a :: k) k (b :: k). [Void2 a b] -> ShowS
forall k (a :: k) k (b :: k). Void2 a b -> String
showList :: [Void2 a b] -> ShowS
$cshowList :: forall k (a :: k) k (b :: k). [Void2 a b] -> ShowS
show :: Void2 a b -> String
$cshow :: forall k (a :: k) k (b :: k). Void2 a b -> String
showsPrec :: Int -> Void2 a b -> ShowS
$cshowsPrec :: forall k (a :: k) k (b :: k). Int -> Void2 a b -> ShowS
Show, ReadPrec [Void2 a b]
ReadPrec (Void2 a b)
ReadS [Void2 a b]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (a :: k) k (b :: k). ReadPrec [Void2 a b]
forall k (a :: k) k (b :: k). ReadPrec (Void2 a b)
forall k (a :: k) k (b :: k). Int -> ReadS (Void2 a b)
forall k (a :: k) k (b :: k). ReadS [Void2 a b]
readListPrec :: ReadPrec [Void2 a b]
$creadListPrec :: forall k (a :: k) k (b :: k). ReadPrec [Void2 a b]
readPrec :: ReadPrec (Void2 a b)
$creadPrec :: forall k (a :: k) k (b :: k). ReadPrec (Void2 a b)
readList :: ReadS [Void2 a b]
$creadList :: forall k (a :: k) k (b :: k). ReadS [Void2 a b]
readsPrec :: Int -> ReadS (Void2 a b)
$creadsPrec :: forall k (a :: k) k (b :: k). Int -> ReadS (Void2 a b)
Read, Void2 a b -> Void2 a b -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
/= :: Void2 a b -> Void2 a b -> Bool
$c/= :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
== :: Void2 a b -> Void2 a b -> Bool
$c== :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
Eq, Void2 a b -> Void2 a b -> Ordering
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 k (a :: k) k (b :: k). Eq (Void2 a b)
forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Ordering
forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Void2 a b
min :: Void2 a b -> Void2 a b -> Void2 a b
$cmin :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Void2 a b
max :: Void2 a b -> Void2 a b -> Void2 a b
$cmax :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Void2 a b
>= :: Void2 a b -> Void2 a b -> Bool
$c>= :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
> :: Void2 a b -> Void2 a b -> Bool
$c> :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
<= :: Void2 a b -> Void2 a b -> Bool
$c<= :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
< :: Void2 a b -> Void2 a b -> Bool
$c< :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Bool
compare :: Void2 a b -> Void2 a b -> Ordering
$ccompare :: forall k (a :: k) k (b :: k). Void2 a b -> Void2 a b -> Ordering
Ord, forall k (a :: k) a b. a -> Void2 a b -> Void2 a a
forall k (a :: k) a b. (a -> b) -> Void2 a a -> Void2 a b
forall a b. (a -> b) -> Void2 a a -> Void2 a b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Void2 a b -> Void2 a a
$c<$ :: forall k (a :: k) a b. a -> Void2 a b -> Void2 a a
fmap :: forall a b. (a -> b) -> Void2 a a -> Void2 a b
$cfmap :: forall k (a :: k) a b. (a -> b) -> Void2 a a -> Void2 a b
Functor, forall k (a :: k) a. Eq a => a -> Void2 a a -> Bool
forall k (a :: k) a. Num a => Void2 a a -> a
forall k (a :: k) a. Ord a => Void2 a a -> a
forall k (a :: k) m. Monoid m => Void2 a m -> m
forall k (a :: k) a. Void2 a a -> Bool
forall k (a :: k) a. Void2 a a -> Int
forall k (a :: k) a. Void2 a a -> [a]
forall k (a :: k) a. (a -> a -> a) -> Void2 a a -> a
forall k (a :: k) m a. Monoid m => (a -> m) -> Void2 a a -> m
forall k (a :: k) b a. (b -> a -> b) -> b -> Void2 a a -> b
forall k (a :: k) a b. (a -> b -> b) -> b -> Void2 a a -> b
forall m a. Monoid m => (a -> m) -> Void2 a a -> m
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Void2 a a -> a
$cproduct :: forall k (a :: k) a. Num a => Void2 a a -> a
sum :: forall a. Num a => Void2 a a -> a
$csum :: forall k (a :: k) a. Num a => Void2 a a -> a
minimum :: forall a. Ord a => Void2 a a -> a
$cminimum :: forall k (a :: k) a. Ord a => Void2 a a -> a
maximum :: forall a. Ord a => Void2 a a -> a
$cmaximum :: forall k (a :: k) a. Ord a => Void2 a a -> a
elem :: forall a. Eq a => a -> Void2 a a -> Bool
$celem :: forall k (a :: k) a. Eq a => a -> Void2 a a -> Bool
length :: forall a. Void2 a a -> Int
$clength :: forall k (a :: k) a. Void2 a a -> Int
null :: forall a. Void2 a a -> Bool
$cnull :: forall k (a :: k) a. Void2 a a -> Bool
toList :: forall a. Void2 a a -> [a]
$ctoList :: forall k (a :: k) a. Void2 a a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Void2 a a -> a
$cfoldl1 :: forall k (a :: k) a. (a -> a -> a) -> Void2 a a -> a
foldr1 :: forall a. (a -> a -> a) -> Void2 a a -> a
$cfoldr1 :: forall k (a :: k) a. (a -> a -> a) -> Void2 a a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Void2 a a -> b
$cfoldl' :: forall k (a :: k) b a. (b -> a -> b) -> b -> Void2 a a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Void2 a a -> b
$cfoldl :: forall k (a :: k) b a. (b -> a -> b) -> b -> Void2 a a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Void2 a a -> b
$cfoldr' :: forall k (a :: k) a b. (a -> b -> b) -> b -> Void2 a a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Void2 a a -> b
$cfoldr :: forall k (a :: k) a b. (a -> b -> b) -> b -> Void2 a a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Void2 a a -> m
$cfoldMap' :: forall k (a :: k) m a. Monoid m => (a -> m) -> Void2 a a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Void2 a a -> m
$cfoldMap :: forall k (a :: k) m a. Monoid m => (a -> m) -> Void2 a a -> m
fold :: forall m. Monoid m => Void2 a m -> m
$cfold :: forall k (a :: k) m. Monoid m => Void2 a m -> m
Foldable, forall k (a :: k). Functor (Void2 a)
forall k (a :: k). Foldable (Void2 a)
forall k (a :: k) (m :: * -> *) a.
Monad m =>
Void2 a (m a) -> m (Void2 a a)
forall k (a :: k) (f :: * -> *) a.
Applicative f =>
Void2 a (f a) -> f (Void2 a a)
forall k (a :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Void2 a a -> m (Void2 a b)
forall k (a :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void2 a a -> f (Void2 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 (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void2 a a -> f (Void2 a b)
sequence :: forall (m :: * -> *) a. Monad m => Void2 a (m a) -> m (Void2 a a)
$csequence :: forall k (a :: k) (m :: * -> *) a.
Monad m =>
Void2 a (m a) -> m (Void2 a a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Void2 a a -> m (Void2 a b)
$cmapM :: forall k (a :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Void2 a a -> m (Void2 a b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Void2 a (f a) -> f (Void2 a a)
$csequenceA :: forall k (a :: k) (f :: * -> *) a.
Applicative f =>
Void2 a (f a) -> f (Void2 a a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void2 a a -> f (Void2 a b)
$ctraverse :: forall k (a :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void2 a a -> f (Void2 a b)
Traversable, Typeable, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (a :: k) k (b :: k) x. Rep (Void2 a b) x -> Void2 a b
forall k (a :: k) k (b :: k) x. Void2 a b -> Rep (Void2 a b) x
$cto :: forall k (a :: k) k (b :: k) x. Rep (Void2 a b) x -> Void2 a b
$cfrom :: forall k (a :: k) k (b :: k) x. Void2 a b -> Rep (Void2 a b) x
Generic, Void2 a b -> DataType
Void2 a b -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {k} {a :: k} {k} {b :: k}.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Typeable (Void2 a b)
forall k (a :: k) k (b :: k).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Void2 a b -> DataType
forall k (a :: k) k (b :: k).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Void2 a b -> Constr
forall k (a :: k) k (b :: k).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall b. Data b => b -> b) -> Void2 a b -> Void2 a b
forall k (a :: k) k (b :: k) u.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Int -> (forall d. Data d => d -> u) -> Void2 a b -> u
forall k (a :: k) k (b :: k) u.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall d. Data d => d -> u) -> Void2 a b -> [u]
forall k (a :: k) k (b :: k) r r'.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Void2 a b -> r
forall k (a :: k) k (b :: k) r r'.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Void2 a b -> r
forall k (a :: k) k (b :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, Monad m) =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
forall k (a :: k) k (b :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
forall k (a :: k) k (b :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void2 a b)
forall k (a :: k) k (b :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void2 a b -> c (Void2 a b)
forall k (a :: k) k (b :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Void2 a b))
forall k (a :: k) k (b :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Void2 a b))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void2 a b)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void2 a b -> c (Void2 a b)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
$cgmapMo :: forall k (a :: k) k (b :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
$cgmapMp :: forall k (a :: k) k (b :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
$cgmapM :: forall k (a :: k) k (b :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, Monad m) =>
(forall d. Data d => d -> m d) -> Void2 a b -> m (Void2 a b)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Void2 a b -> u
$cgmapQi :: forall k (a :: k) k (b :: k) u.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Int -> (forall d. Data d => d -> u) -> Void2 a b -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Void2 a b -> [u]
$cgmapQ :: forall k (a :: k) k (b :: k) u.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall d. Data d => d -> u) -> Void2 a b -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Void2 a b -> r
$cgmapQr :: forall k (a :: k) k (b :: k) r r'.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Void2 a b -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Void2 a b -> r
$cgmapQl :: forall k (a :: k) k (b :: k) r r'.
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Void2 a b -> r
gmapT :: (forall b. Data b => b -> b) -> Void2 a b -> Void2 a b
$cgmapT :: forall k (a :: k) k (b :: k).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall b. Data b => b -> b) -> Void2 a b -> Void2 a b
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Void2 a b))
$cdataCast2 :: forall k (a :: k) k (b :: k) (t :: * -> * -> *) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Void2 a b))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Void2 a b))
$cdataCast1 :: forall k (a :: k) k (b :: k) (t :: * -> *) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Void2 a b))
dataTypeOf :: Void2 a b -> DataType
$cdataTypeOf :: forall k (a :: k) k (b :: k).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Void2 a b -> DataType
toConstr :: Void2 a b -> Constr
$ctoConstr :: forall k (a :: k) k (b :: k).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
Void2 a b -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void2 a b)
$cgunfold :: forall k (a :: k) k (b :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void2 a b)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void2 a b -> c (Void2 a b)
$cgfoldl :: forall k (a :: k) k (b :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable k, Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void2 a b -> c (Void2 a b)
Data)

deriveShow1 ''Void2
deriveRead1 ''Void2
deriveEq1 ''Void2
deriveOrd1 ''Void2

instance Semigroup (Void2 a b) where
    Void2 a b
x <> :: Void2 a b -> Void2 a b -> Void2 a b
<> Void2 a b
_ = case Void2 a b
x of {}

instance Alt (Void2 a) where
    Void2 a a
x <!> :: forall a. Void2 a a -> Void2 a a -> Void2 a a
<!> Void2 a a
_ = forall {k} {k} (f :: k) (a :: k) (t :: k -> k -> *).
Void2 f a -> t f a
absurd2 Void2 a a
x

instance Bind (Void2 a) where
    Void2 a a
x >>- :: forall a b. Void2 a a -> (a -> Void2 a b) -> Void2 a b
>>- a -> Void2 a b
_ = case Void2 a a
x of {}

instance Apply (Void2 a) where
    Void2 a (a -> b)
x <.> :: forall a b. Void2 a (a -> b) -> Void2 a a -> Void2 a b
<.> Void2 a a
_ = case Void2 a (a -> b)
x of {}

-- | @since 0.3.0.0
instance Contravariant (Void2 a) where
    contramap :: forall a' a. (a' -> a) -> Void2 a a -> Void2 a a'
contramap a' -> a
_ = \case {}
-- | @since 0.3.0.0
instance Invariant (Void2 a) where
    invmap :: forall a b. (a -> b) -> (b -> a) -> Void2 a a -> Void2 a b
invmap a -> b
_ b -> a
_ = \case {}

-- | If you treat a @'Void2' f a@ as a functor combinator, then 'absurd2'
-- lets you convert from a @'Void2' f a@ into a @t f a@ for any functor
-- combinator @t@.
absurd2 :: Void2 f a -> t f a
absurd2 :: forall {k} {k} (f :: k) (a :: k) (t :: k -> k -> *).
Void2 f a -> t f a
absurd2 = \case {}

-- | @'Void3' a b@ is uninhabited for all @a@ and @b@.
data Void3 a b c
  deriving (Int -> Void3 a b c -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (a :: k) k (b :: k) k (c :: k).
Int -> Void3 a b c -> ShowS
forall k (a :: k) k (b :: k) k (c :: k). [Void3 a b c] -> ShowS
forall k (a :: k) k (b :: k) k (c :: k). Void3 a b c -> String
showList :: [Void3 a b c] -> ShowS
$cshowList :: forall k (a :: k) k (b :: k) k (c :: k). [Void3 a b c] -> ShowS
show :: Void3 a b c -> String
$cshow :: forall k (a :: k) k (b :: k) k (c :: k). Void3 a b c -> String
showsPrec :: Int -> Void3 a b c -> ShowS
$cshowsPrec :: forall k (a :: k) k (b :: k) k (c :: k).
Int -> Void3 a b c -> ShowS
Show, ReadPrec [Void3 a b c]
ReadPrec (Void3 a b c)
ReadS [Void3 a b c]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (a :: k) k (b :: k) k (c :: k). ReadPrec [Void3 a b c]
forall k (a :: k) k (b :: k) k (c :: k). ReadPrec (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k). Int -> ReadS (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k). ReadS [Void3 a b c]
readListPrec :: ReadPrec [Void3 a b c]
$creadListPrec :: forall k (a :: k) k (b :: k) k (c :: k). ReadPrec [Void3 a b c]
readPrec :: ReadPrec (Void3 a b c)
$creadPrec :: forall k (a :: k) k (b :: k) k (c :: k). ReadPrec (Void3 a b c)
readList :: ReadS [Void3 a b c]
$creadList :: forall k (a :: k) k (b :: k) k (c :: k). ReadS [Void3 a b c]
readsPrec :: Int -> ReadS (Void3 a b c)
$creadsPrec :: forall k (a :: k) k (b :: k) k (c :: k). Int -> ReadS (Void3 a b c)
Read, Void3 a b c -> Void3 a b c -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
/= :: Void3 a b c -> Void3 a b c -> Bool
$c/= :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
== :: Void3 a b c -> Void3 a b c -> Bool
$c== :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
Eq, Void3 a b c -> Void3 a b c -> Ordering
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 k (a :: k) k (b :: k) k (c :: k). Eq (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Ordering
forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Void3 a b c
min :: Void3 a b c -> Void3 a b c -> Void3 a b c
$cmin :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Void3 a b c
max :: Void3 a b c -> Void3 a b c -> Void3 a b c
$cmax :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Void3 a b c
>= :: Void3 a b c -> Void3 a b c -> Bool
$c>= :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
> :: Void3 a b c -> Void3 a b c -> Bool
$c> :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
<= :: Void3 a b c -> Void3 a b c -> Bool
$c<= :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
< :: Void3 a b c -> Void3 a b c -> Bool
$c< :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Bool
compare :: Void3 a b c -> Void3 a b c -> Ordering
$ccompare :: forall k (a :: k) k (b :: k) k (c :: k).
Void3 a b c -> Void3 a b c -> Ordering
Ord, forall k (a :: k) k (b :: k) a b. a -> Void3 a b b -> Void3 a b a
forall k (a :: k) k (b :: k) a b.
(a -> b) -> Void3 a b a -> Void3 a b b
forall a b. (a -> b) -> Void3 a b a -> Void3 a b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Void3 a b b -> Void3 a b a
$c<$ :: forall k (a :: k) k (b :: k) a b. a -> Void3 a b b -> Void3 a b a
fmap :: forall a b. (a -> b) -> Void3 a b a -> Void3 a b b
$cfmap :: forall k (a :: k) k (b :: k) a b.
(a -> b) -> Void3 a b a -> Void3 a b b
Functor, forall k (a :: k) k (b :: k) a. Eq a => a -> Void3 a b a -> Bool
forall k (a :: k) k (b :: k) a. Num a => Void3 a b a -> a
forall k (a :: k) k (b :: k) a. Ord a => Void3 a b a -> a
forall k (a :: k) k (b :: k) m. Monoid m => Void3 a b m -> m
forall k (a :: k) k (b :: k) a. Void3 a b a -> Bool
forall k (a :: k) k (b :: k) a. Void3 a b a -> Int
forall k (a :: k) k (b :: k) a. Void3 a b a -> [a]
forall k (a :: k) k (b :: k) a. (a -> a -> a) -> Void3 a b a -> a
forall k (a :: k) k (b :: k) m a.
Monoid m =>
(a -> m) -> Void3 a b a -> m
forall k (a :: k) k (b :: k) b a.
(b -> a -> b) -> b -> Void3 a b a -> b
forall k (a :: k) k (b :: k) a b.
(a -> b -> b) -> b -> Void3 a b a -> b
forall m a. Monoid m => (a -> m) -> Void3 a b a -> m
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Void3 a b a -> a
$cproduct :: forall k (a :: k) k (b :: k) a. Num a => Void3 a b a -> a
sum :: forall a. Num a => Void3 a b a -> a
$csum :: forall k (a :: k) k (b :: k) a. Num a => Void3 a b a -> a
minimum :: forall a. Ord a => Void3 a b a -> a
$cminimum :: forall k (a :: k) k (b :: k) a. Ord a => Void3 a b a -> a
maximum :: forall a. Ord a => Void3 a b a -> a
$cmaximum :: forall k (a :: k) k (b :: k) a. Ord a => Void3 a b a -> a
elem :: forall a. Eq a => a -> Void3 a b a -> Bool
$celem :: forall k (a :: k) k (b :: k) a. Eq a => a -> Void3 a b a -> Bool
length :: forall a. Void3 a b a -> Int
$clength :: forall k (a :: k) k (b :: k) a. Void3 a b a -> Int
null :: forall a. Void3 a b a -> Bool
$cnull :: forall k (a :: k) k (b :: k) a. Void3 a b a -> Bool
toList :: forall a. Void3 a b a -> [a]
$ctoList :: forall k (a :: k) k (b :: k) a. Void3 a b a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Void3 a b a -> a
$cfoldl1 :: forall k (a :: k) k (b :: k) a. (a -> a -> a) -> Void3 a b a -> a
foldr1 :: forall a. (a -> a -> a) -> Void3 a b a -> a
$cfoldr1 :: forall k (a :: k) k (b :: k) a. (a -> a -> a) -> Void3 a b a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Void3 a b a -> b
$cfoldl' :: forall k (a :: k) k (b :: k) b a.
(b -> a -> b) -> b -> Void3 a b a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Void3 a b a -> b
$cfoldl :: forall k (a :: k) k (b :: k) b a.
(b -> a -> b) -> b -> Void3 a b a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Void3 a b a -> b
$cfoldr' :: forall k (a :: k) k (b :: k) a b.
(a -> b -> b) -> b -> Void3 a b a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Void3 a b a -> b
$cfoldr :: forall k (a :: k) k (b :: k) a b.
(a -> b -> b) -> b -> Void3 a b a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Void3 a b a -> m
$cfoldMap' :: forall k (a :: k) k (b :: k) m a.
Monoid m =>
(a -> m) -> Void3 a b a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Void3 a b a -> m
$cfoldMap :: forall k (a :: k) k (b :: k) m a.
Monoid m =>
(a -> m) -> Void3 a b a -> m
fold :: forall m. Monoid m => Void3 a b m -> m
$cfold :: forall k (a :: k) k (b :: k) m. Monoid m => Void3 a b m -> m
Foldable, forall k (a :: k) k (b :: k). Functor (Void3 a b)
forall k (a :: k) k (b :: k). Foldable (Void3 a b)
forall k (a :: k) k (b :: k) (m :: * -> *) a.
Monad m =>
Void3 a b (m a) -> m (Void3 a b a)
forall k (a :: k) k (b :: k) (f :: * -> *) a.
Applicative f =>
Void3 a b (f a) -> f (Void3 a b a)
forall k (a :: k) k (b :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Void3 a b a -> m (Void3 a b b)
forall k (a :: k) k (b :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void3 a b a -> f (Void3 a b 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 (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void3 a b a -> f (Void3 a b b)
sequence :: forall (m :: * -> *) a.
Monad m =>
Void3 a b (m a) -> m (Void3 a b a)
$csequence :: forall k (a :: k) k (b :: k) (m :: * -> *) a.
Monad m =>
Void3 a b (m a) -> m (Void3 a b a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Void3 a b a -> m (Void3 a b b)
$cmapM :: forall k (a :: k) k (b :: k) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Void3 a b a -> m (Void3 a b b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Void3 a b (f a) -> f (Void3 a b a)
$csequenceA :: forall k (a :: k) k (b :: k) (f :: * -> *) a.
Applicative f =>
Void3 a b (f a) -> f (Void3 a b a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void3 a b a -> f (Void3 a b b)
$ctraverse :: forall k (a :: k) k (b :: k) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Void3 a b a -> f (Void3 a b b)
Traversable, Typeable, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (a :: k) k (b :: k) k (c :: k) x.
Rep (Void3 a b c) x -> Void3 a b c
forall k (a :: k) k (b :: k) k (c :: k) x.
Void3 a b c -> Rep (Void3 a b c) x
$cto :: forall k (a :: k) k (b :: k) k (c :: k) x.
Rep (Void3 a b c) x -> Void3 a b c
$cfrom :: forall k (a :: k) k (b :: k) k (c :: k) x.
Void3 a b c -> Rep (Void3 a b c) x
Generic, Void3 a b c -> DataType
Void3 a b c -> Constr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall {k} {a :: k} {k} {b :: k} {k} {c :: k}.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Typeable (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Void3 a b c -> DataType
forall k (a :: k) k (b :: k) k (c :: k).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Void3 a b c -> Constr
forall k (a :: k) k (b :: k) k (c :: k).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall b. Data b => b -> b) -> Void3 a b c -> Void3 a b c
forall k (a :: k) k (b :: k) k (c :: k) u.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Int -> (forall d. Data d => d -> u) -> Void3 a b c -> u
forall k (a :: k) k (b :: k) k (c :: k) u.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall d. Data d => d -> u) -> Void3 a b c -> [u]
forall k (a :: k) k (b :: k) k (c :: k) r r'.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Void3 a b c -> r
forall k (a :: k) k (b :: k) k (c :: k) r r'.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Void3 a b c -> r
forall k (a :: k) k (b :: k) k (c :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, Monad m) =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void3 a b c -> c (Void3 a b c)
forall k (a :: k) k (b :: k) k (c :: k) (t :: * -> *)
       (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Void3 a b c))
forall k (a :: k) k (b :: k) k (c :: k) (t :: * -> * -> *)
       (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Void3 a b c))
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void3 a b c)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void3 a b c -> c (Void3 a b c)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
$cgmapMo :: forall k (a :: k) k (b :: k) k (c :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
$cgmapMp :: forall k (a :: k) k (b :: k) k (c :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
$cgmapM :: forall k (a :: k) k (b :: k) k (c :: k) (m :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, Monad m) =>
(forall d. Data d => d -> m d) -> Void3 a b c -> m (Void3 a b c)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Void3 a b c -> u
$cgmapQi :: forall k (a :: k) k (b :: k) k (c :: k) u.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Int -> (forall d. Data d => d -> u) -> Void3 a b c -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Void3 a b c -> [u]
$cgmapQ :: forall k (a :: k) k (b :: k) k (c :: k) u.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall d. Data d => d -> u) -> Void3 a b c -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Void3 a b c -> r
$cgmapQr :: forall k (a :: k) k (b :: k) k (c :: k) r r'.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Void3 a b c -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Void3 a b c -> r
$cgmapQl :: forall k (a :: k) k (b :: k) k (c :: k) r r'.
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Void3 a b c -> r
gmapT :: (forall b. Data b => b -> b) -> Void3 a b c -> Void3 a b c
$cgmapT :: forall k (a :: k) k (b :: k) k (c :: k).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall b. Data b => b -> b) -> Void3 a b c -> Void3 a b c
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Void3 a b c))
$cdataCast2 :: forall k (a :: k) k (b :: k) k (c :: k) (t :: * -> * -> *)
       (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Void3 a b c))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Void3 a b c))
$cdataCast1 :: forall k (a :: k) k (b :: k) k (c :: k) (t :: * -> *)
       (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Void3 a b c))
dataTypeOf :: Void3 a b c -> DataType
$cdataTypeOf :: forall k (a :: k) k (b :: k) k (c :: k).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Void3 a b c -> DataType
toConstr :: Void3 a b c -> Constr
$ctoConstr :: forall k (a :: k) k (b :: k) k (c :: k).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
Void3 a b c -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void3 a b c)
$cgunfold :: forall k (a :: k) k (b :: k) k (c :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Void3 a b c)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void3 a b c -> c (Void3 a b c)
$cgfoldl :: forall k (a :: k) k (b :: k) k (c :: k) (c :: * -> *).
(Typeable a, Typeable b, Typeable c, Typeable k, Typeable k,
 Typeable k) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Void3 a b c -> c (Void3 a b c)
Data)

deriveShow1 ''Void3
deriveRead1 ''Void3
deriveEq1 ''Void3
deriveOrd1 ''Void3

instance Semigroup (Void3 a b c) where
    Void3 a b c
x <> :: Void3 a b c -> Void3 a b c -> Void3 a b c
<> Void3 a b c
_ = case Void3 a b c
x of {}

instance Alt (Void3 a b) where
    Void3 a b a
x <!> :: forall a. Void3 a b a -> Void3 a b a -> Void3 a b a
<!> Void3 a b a
_ = forall {k} {k} {k} (f :: k) (g :: k) (a :: k)
       (t :: k -> k -> k -> *).
Void3 f g a -> t f g a
absurd3 Void3 a b a
x

instance Bind (Void3 a b) where
    Void3 a b a
x >>- :: forall a b. Void3 a b a -> (a -> Void3 a b b) -> Void3 a b b
>>- a -> Void3 a b b
_ = case Void3 a b a
x of {}

instance Apply (Void3 a b) where
    Void3 a b (a -> b)
x <.> :: forall a b. Void3 a b (a -> b) -> Void3 a b a -> Void3 a b b
<.> Void3 a b a
_ = case Void3 a b (a -> b)
x of {}

-- | @since 0.3.0.0
instance Contravariant (Void3 a b) where
    contramap :: forall a' a. (a' -> a) -> Void3 a b a -> Void3 a b a'
contramap a' -> a
_ = \case {}
-- | @since 0.3.0.0
instance Invariant (Void3 a b) where
    invmap :: forall a b. (a -> b) -> (b -> a) -> Void3 a b a -> Void3 a b b
invmap a -> b
_ b -> a
_ = \case {}

-- | If you treat a @'Void3' f a@ as a binary functor combinator, then
-- 'absurd3' lets you convert from a @'Void3' f a@ into a @t f a@ for any
-- functor combinator @t@.
absurd3 :: Void3 f g a -> t f g a
absurd3 :: forall {k} {k} {k} (f :: k) (g :: k) (a :: k)
       (t :: k -> k -> k -> *).
Void3 f g a -> t f g a
absurd3 = \case {}