-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Data type like Either but with accumulating error type
--   
--   Please see the <a>Accuerr</a> Haddock documentation for more
--   information.
@package accuerr
@version 0.2.0.2


-- | Provides <a>Accuerr</a>, a type similar to <a>Either</a> but where the
--   <tt>Applicative</tt> instance accumulates error values. This module is
--   based on work in the <tt>validation</tt> package, which is available
--   at
--   
--   <a>https://hackage.haskell.org/package/validation</a>
--   
--   The main differences between the <tt>validation</tt> package and this
--   one:
--   
--   <ul>
--   <li><tt>validation</tt> has more data types, many of which overlap
--   with those available in other packages. This package sticks with the
--   <a>Accuerr</a> type only.</li>
--   <li>This package works with GHC 8; as of 2016-06-11,
--   <tt>validation</tt> does not.</li>
--   <li><a>Accuerr</a> has fewer typeclass instances than its
--   corresponding type in <tt>validation</tt>.</li>
--   </ul>
module Accuerr

-- | A type similar to <a>Either</a> but the <a>Applicative</a> instance
--   accumulates error values. Unlike <a>Either</a>, there is no
--   <a>Monad</a> instance, because there is no <a>&gt;&gt;=</a> such that
--   <a>ap</a> equals <a>&lt;*&gt;</a>.
--   
--   For the <a>Applicative</a> instance to work, your error type must be a
--   <a>Semigroup</a>, such as a list or a <a>NonEmpty</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; import Text.Read
--   
--   &gt;&gt;&gt; :{
--          let readInt x = case readMaybe x of
--                Nothing -&gt; AccFailure [x]
--                Just a -&gt; AccSuccess a
--                  where _types = a :: Int
--       :}
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (+) &lt;$&gt; readInt "3" &lt;*&gt; readInt "4"
--   AccSuccess 7
--   
--   &gt;&gt;&gt; (+) &lt;$&gt; readInt "x3" &lt;*&gt; readInt "4"
--   AccFailure ["x3"]
--   
--   &gt;&gt;&gt; (+) &lt;$&gt; readInt "x3" &lt;*&gt; readInt "x4"
--   AccFailure ["x3","x4"]
--   
--   &gt;&gt;&gt; (,,) &lt;$&gt; readInt "3" &lt;*&gt; readInt "4" &lt;*&gt; readInt "x5"
--   AccFailure ["x5"]
--   
--   &gt;&gt;&gt; sequenceA [AccSuccess 3, AccSuccess 4]
--   AccSuccess [3,4]
--   
--   &gt;&gt;&gt; sequenceA [AccSuccess 3, AccSuccess 4, AccFailure ['c'], AccFailure ['a']]
--   AccFailure "ca"
--   </pre>
data Accuerr e a
AccFailure :: e -> Accuerr e a
AccSuccess :: a -> Accuerr e a
_AccSuccess :: forall e_a8sH a_a8sI a_aeul. Prism (Accuerr e_a8sH a_aeul) (Accuerr e_a8sH a_a8sI) a_aeul a_a8sI
_AccFailure :: forall e_a8sH a_a8sI e_aeug. Prism (Accuerr e_aeug a_a8sI) (Accuerr e_a8sH a_a8sI) e_aeug e_a8sH

-- | Case analysis for the <a>Accuerr</a> type. Like <a>either</a>.
accuerr :: (a -> c) -> (b -> c) -> Accuerr a b -> c
accuerrToEither :: Accuerr e a -> Either e a
eitherToAccuerr :: Either e a -> Accuerr e a
isoAccuerrEither :: Iso' (Accuerr e a) (Either e a)
isoEitherAccuerr :: Iso' (Either e a) (Accuerr e a)
instance GHC.Base.Semigroup e => GHC.Base.Applicative (Accuerr.Accuerr e)
instance Data.Bifunctor.Bifunctor Accuerr.Accuerr
instance Data.Bifoldable.Bifoldable Accuerr.Accuerr
instance Data.Bitraversable.Bitraversable Accuerr.Accuerr
instance Control.Lens.Iso.Swapped Accuerr.Accuerr
instance Data.Traversable.Traversable (Accuerr.Accuerr e)
instance Data.Foldable.Foldable (Accuerr.Accuerr e)
instance GHC.Base.Functor (Accuerr.Accuerr e)
instance (GHC.Show.Show e, GHC.Show.Show a) => GHC.Show.Show (Accuerr.Accuerr e a)
instance (GHC.Classes.Ord e, GHC.Classes.Ord a) => GHC.Classes.Ord (Accuerr.Accuerr e a)
instance (GHC.Classes.Eq e, GHC.Classes.Eq a) => GHC.Classes.Eq (Accuerr.Accuerr e a)
