-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | An either-or-both data type.
--
-- This package provides a data type These a b which can hold a
-- value of either type or values of each type. This is usually thought
-- of as an "inclusive or" type (contrasting Either a b as
-- "exclusive or") or as an "outer join" type (contrasting (a,
-- b) as "inner join").
--
--
-- data These a b = This a | That b | These a b
--
--
-- Since version 1, this package was split into parts:
--
--
@package these
@version 1
module Data.Functor.These
data These1 f g a
This1 :: f a -> These1 f g a
That1 :: g a -> These1 f g a
These1 :: f a -> g a -> These1 f g a
instance (Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable a, Data.Data.Data (f a), Data.Data.Data (g a)) => Data.Data.Data (Data.Functor.These.These1 f g a)
instance GHC.Generics.Generic1 (Data.Functor.These.These1 f g)
instance GHC.Generics.Generic (Data.Functor.These.These1 f g a)
instance (Data.Traversable.Traversable f, Data.Traversable.Traversable g) => Data.Traversable.Traversable (Data.Functor.These.These1 f g)
instance (Data.Foldable.Foldable f, Data.Foldable.Foldable g) => Data.Foldable.Foldable (Data.Functor.These.These1 f g)
instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (Data.Functor.These.These1 f g)
instance (Data.Functor.Classes.Eq1 f, Data.Functor.Classes.Eq1 g) => Data.Functor.Classes.Eq1 (Data.Functor.These.These1 f g)
instance (Data.Functor.Classes.Ord1 f, Data.Functor.Classes.Ord1 g) => Data.Functor.Classes.Ord1 (Data.Functor.These.These1 f g)
instance (Data.Functor.Classes.Show1 f, Data.Functor.Classes.Show1 g) => Data.Functor.Classes.Show1 (Data.Functor.These.These1 f g)
instance (Data.Functor.Classes.Read1 f, Data.Functor.Classes.Read1 g) => Data.Functor.Classes.Read1 (Data.Functor.These.These1 f g)
instance (Data.Functor.Classes.Eq1 f, Data.Functor.Classes.Eq1 g, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Functor.These.These1 f g a)
instance (Data.Functor.Classes.Ord1 f, Data.Functor.Classes.Ord1 g, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Functor.These.These1 f g a)
instance (Data.Functor.Classes.Show1 f, Data.Functor.Classes.Show1 g, GHC.Show.Show a) => GHC.Show.Show (Data.Functor.These.These1 f g a)
instance (Data.Functor.Classes.Read1 f, Data.Functor.Classes.Read1 g, GHC.Read.Read a) => GHC.Read.Read (Data.Functor.These.These1 f g a)
instance (Control.DeepSeq.NFData1 f, Control.DeepSeq.NFData1 g) => Control.DeepSeq.NFData1 (Data.Functor.These.These1 f g)
instance (Control.DeepSeq.NFData1 f, Control.DeepSeq.NFData1 g, Control.DeepSeq.NFData a) => Control.DeepSeq.NFData (Data.Functor.These.These1 f g a)
instance (Data.Aeson.Types.ToJSON.ToJSON1 f, Data.Aeson.Types.ToJSON.ToJSON1 g) => Data.Aeson.Types.ToJSON.ToJSON1 (Data.Functor.These.These1 f g)
instance (Data.Aeson.Types.FromJSON.FromJSON1 f, Data.Aeson.Types.FromJSON.FromJSON1 g) => Data.Aeson.Types.FromJSON.FromJSON1 (Data.Functor.These.These1 f g)
instance (Data.Aeson.Types.ToJSON.ToJSON1 f, Data.Aeson.Types.ToJSON.ToJSON1 g, Data.Aeson.Types.ToJSON.ToJSON a) => Data.Aeson.Types.ToJSON.ToJSON (Data.Functor.These.These1 f g a)
instance (Data.Aeson.Types.FromJSON.FromJSON1 f, Data.Aeson.Types.FromJSON.FromJSON1 g, Data.Aeson.Types.FromJSON.FromJSON a) => Data.Aeson.Types.FromJSON.FromJSON (Data.Functor.These.These1 f g a)
instance (Test.QuickCheck.Arbitrary.Arbitrary1 f, Test.QuickCheck.Arbitrary.Arbitrary1 g) => Test.QuickCheck.Arbitrary.Arbitrary1 (Data.Functor.These.These1 f g)
instance (Test.QuickCheck.Arbitrary.Arbitrary1 f, Test.QuickCheck.Arbitrary.Arbitrary1 g, Test.QuickCheck.Arbitrary.Arbitrary a) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Functor.These.These1 f g a)
-- | The These type and associated operations. Now enhanced with
-- Control.Lens magic!
module Data.These
-- | The These type represents values with two non-exclusive
-- possibilities.
--
-- This can be useful to represent combinations of two values, where the
-- combination is defined if either input is. Algebraically, the type
-- These A B represents (A + B + AB), which
-- doesn't factor easily into sums and products--a type like
-- Either A (B, Maybe A) is unclear and awkward to
-- use.
--
-- These has straightforward instances of Functor,
-- Monad, &c., and behaves like a hybrid error/writer monad,
-- as would be expected.
--
-- For zipping and unzipping of structures with These values, see
-- Data.Align.
data These a b
This :: a -> These a b
That :: b -> These a b
These :: a -> b -> These a b
-- | Case analysis for the These type.
these :: (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c
-- | Takes two default values and produces a tuple.
fromThese :: a -> b -> These a b -> (a, b)
-- | Coalesce with the provided operation.
mergeThese :: (a -> a -> a) -> These a a -> a
-- | bimap and coalesce results with the provided operation.
mergeTheseWith :: (a -> c) -> (b -> c) -> (c -> c -> c) -> These a b -> c
-- | Select each constructor and partition them into separate lists.
partitionThese :: [These a b] -> ([a], [b], [(a, b)])
-- | Select here and there elements and partition them
-- into separate lists.
partitionHereThere :: [These a b] -> ([a], [b])
distrThesePair :: These (a, b) c -> (These a c, These b c)
undistrThesePair :: (These a c, These b c) -> These (a, b) c
distrPairThese :: (These a b, c) -> These (a, c) (b, c)
undistrPairThese :: These (a, c) (b, c) -> (These a b, c)
instance GHC.Generics.Generic1 (Data.These.These a)
instance GHC.Generics.Generic (Data.These.These a b)
instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Data.These.These a b)
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Data.These.These a b)
instance (GHC.Read.Read a, GHC.Read.Read b) => GHC.Read.Read (Data.These.These a b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Data.These.These a b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Data.These.These a b)
instance (GHC.Base.Semigroup a, GHC.Base.Semigroup b) => GHC.Base.Semigroup (Data.These.These a b)
instance GHC.Base.Functor (Data.These.These a)
instance Data.Foldable.Foldable (Data.These.These a)
instance Data.Traversable.Traversable (Data.These.These a)
instance Data.Bifunctor.Bifunctor Data.These.These
instance Data.Bifoldable.Bifoldable Data.These.These
instance Data.Bitraversable.Bitraversable Data.These.These
instance GHC.Base.Semigroup a => GHC.Base.Applicative (Data.These.These a)
instance GHC.Base.Semigroup a => GHC.Base.Monad (Data.These.These a)
instance (Data.Hashable.Class.Hashable a, Data.Hashable.Class.Hashable b) => Data.Hashable.Class.Hashable (Data.These.These a b)
instance Data.Bifunctor.Swap.Swap Data.These.These
instance Data.Bifunctor.Assoc.Assoc Data.These.These
instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Data.These.These a b)
instance (Data.Binary.Class.Binary a, Data.Binary.Class.Binary b) => Data.Binary.Class.Binary (Data.These.These a b)
instance Data.Semigroup.Foldable.Class.Bifoldable1 Data.These.These
instance Data.Semigroup.Traversable.Class.Bitraversable1 Data.These.These
instance GHC.Base.Semigroup a => Data.Functor.Bind.Class.Bind (Data.These.These a)
instance GHC.Base.Semigroup a => Data.Functor.Bind.Class.Apply (Data.These.These a)
instance (Data.Aeson.Types.ToJSON.ToJSON a, Data.Aeson.Types.ToJSON.ToJSON b) => Data.Aeson.Types.ToJSON.ToJSON (Data.These.These a b)
instance (Data.Aeson.Types.FromJSON.FromJSON a, Data.Aeson.Types.FromJSON.FromJSON b) => Data.Aeson.Types.FromJSON.FromJSON (Data.These.These a b)
instance Data.Aeson.Types.ToJSON.ToJSON2 Data.These.These
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON1 (Data.These.These a)
instance Data.Aeson.Types.FromJSON.FromJSON2 Data.These.These
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON1 (Data.These.These a)
instance Test.QuickCheck.Arbitrary.Arbitrary2 Data.These.These
instance Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary1 (Data.These.These a)
instance (Test.QuickCheck.Arbitrary.Arbitrary a, Test.QuickCheck.Arbitrary.Arbitrary b) => Test.QuickCheck.Arbitrary.Arbitrary (Data.These.These a b)
instance (Test.QuickCheck.Function.Function a, Test.QuickCheck.Function.Function b) => Test.QuickCheck.Function.Function (Data.These.These a b)
instance (Test.QuickCheck.Arbitrary.CoArbitrary a, Test.QuickCheck.Arbitrary.CoArbitrary b) => Test.QuickCheck.Arbitrary.CoArbitrary (Data.These.These a b)
-- | This module provides
--
--
module Data.These.Combinators
-- | Bifunctor bimap.
bimapThese :: (a -> c) -> (b -> d) -> These a b -> These c d
-- |
-- mapHere = over here
--
mapHere :: (a -> c) -> These a b -> These c b
-- |
-- mapThere = over there
--
mapThere :: (b -> d) -> These a b -> These a d
-- | Bitraversable bitraverse.
bitraverseThese :: Applicative f => (a -> f c) -> (b -> f d) -> These a b -> f (These c d)
-- | These is commutative.
--
--
-- swapThese . swapThese = id
--
swapThese :: These a b -> These b a
-- | These is associative.
--
--
-- assocThese . unassocThese = id
-- unassocThese . assocThese = id
--
assocThese :: These (These a b) c -> These a (These b c)
-- | These is associative. See assocThese.
unassocThese :: These a (These b c) -> These (These a b) c
justThis :: These a b -> Maybe a
justThat :: These a b -> Maybe b
justThese :: These a b -> Maybe (a, b)
-- |
-- >>> justHere (This 'x')
-- Just 'x'
--
--
--
-- >>> justHere (That 'y')
-- Nothing
--
--
--
-- >>> justHere (These 'x' 'y')
-- Just 'x'
--
justHere :: These a b -> Maybe a
-- |
-- >>> justThere (This 'x')
-- Nothing
--
--
--
-- >>> justThere (That 'y')
-- Just 'y'
--
--
--
-- >>> justThere (These 'x' 'y')
-- Just 'y'
--
justThere :: These a b -> Maybe b
-- | Select all This constructors from a list.
catThis :: [These a b] -> [a]
-- | Select all That constructors from a list.
catThat :: [These a b] -> [b]
-- | Select all These constructors from a list.
catThese :: [These a b] -> [(a, b)]
catHere :: [These a b] -> [a]
catThere :: [These a b] -> [b]
-- |
-- isThis = isJust . justThis
--
isThis :: These a b -> Bool
-- |
-- isThat = isJust . justThat
--
isThat :: These a b -> Bool
-- |
-- isThese = isJust . justThese
--
isThese :: These a b -> Bool
-- |
-- hasHere = isJust . justHere
--
hasHere :: These a b -> Bool
-- |
-- hasThere = isJust . justThere
--
hasThere :: These a b -> Bool
mapThis :: (a -> a) -> These a b -> These a b
mapThat :: (b -> b) -> These a b -> These a b
mapThese :: ((a, b) -> (a, b)) -> These a b -> These a b