module DP.Backtraced.Core where
import Control.Lens
import Data.Foldable
import GHC.Generics (Generic)
import qualified Data.Sequence as Seq
import qualified Test.QuickCheck as QC
import qualified Test.SmallCheck.Series as SC
data Backtraced ty where
Epsilon ∷ Backtraced ty
Cons ∷ ty → Backtraced ty → Backtraced ty
Snoc ∷ Backtraced ty → ty → Backtraced ty
Append ∷ Backtraced ty → Backtraced ty → Backtraced ty
deriving (Backtraced ty -> Backtraced ty -> Bool
(Backtraced ty -> Backtraced ty -> Bool)
-> (Backtraced ty -> Backtraced ty -> Bool) -> Eq (Backtraced ty)
forall ty. Eq ty => Backtraced ty -> Backtraced ty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Backtraced ty -> Backtraced ty -> Bool
$c/= :: forall ty. Eq ty => Backtraced ty -> Backtraced ty -> Bool
== :: Backtraced ty -> Backtraced ty -> Bool
$c== :: forall ty. Eq ty => Backtraced ty -> Backtraced ty -> Bool
Eq,Eq (Backtraced ty)
Eq (Backtraced ty)
-> (Backtraced ty -> Backtraced ty -> Ordering)
-> (Backtraced ty -> Backtraced ty -> Bool)
-> (Backtraced ty -> Backtraced ty -> Bool)
-> (Backtraced ty -> Backtraced ty -> Bool)
-> (Backtraced ty -> Backtraced ty -> Bool)
-> (Backtraced ty -> Backtraced ty -> Backtraced ty)
-> (Backtraced ty -> Backtraced ty -> Backtraced ty)
-> Ord (Backtraced ty)
Backtraced ty -> Backtraced ty -> Bool
Backtraced ty -> Backtraced ty -> Ordering
Backtraced ty -> Backtraced ty -> Backtraced ty
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 ty. Ord ty => Eq (Backtraced ty)
forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Bool
forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Ordering
forall ty.
Ord ty =>
Backtraced ty -> Backtraced ty -> Backtraced ty
min :: Backtraced ty -> Backtraced ty -> Backtraced ty
$cmin :: forall ty.
Ord ty =>
Backtraced ty -> Backtraced ty -> Backtraced ty
max :: Backtraced ty -> Backtraced ty -> Backtraced ty
$cmax :: forall ty.
Ord ty =>
Backtraced ty -> Backtraced ty -> Backtraced ty
>= :: Backtraced ty -> Backtraced ty -> Bool
$c>= :: forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Bool
> :: Backtraced ty -> Backtraced ty -> Bool
$c> :: forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Bool
<= :: Backtraced ty -> Backtraced ty -> Bool
$c<= :: forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Bool
< :: Backtraced ty -> Backtraced ty -> Bool
$c< :: forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Bool
compare :: Backtraced ty -> Backtraced ty -> Ordering
$ccompare :: forall ty. Ord ty => Backtraced ty -> Backtraced ty -> Ordering
$cp1Ord :: forall ty. Ord ty => Eq (Backtraced ty)
Ord,Int -> Backtraced ty -> ShowS
[Backtraced ty] -> ShowS
Backtraced ty -> String
(Int -> Backtraced ty -> ShowS)
-> (Backtraced ty -> String)
-> ([Backtraced ty] -> ShowS)
-> Show (Backtraced ty)
forall ty. Show ty => Int -> Backtraced ty -> ShowS
forall ty. Show ty => [Backtraced ty] -> ShowS
forall ty. Show ty => Backtraced ty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Backtraced ty] -> ShowS
$cshowList :: forall ty. Show ty => [Backtraced ty] -> ShowS
show :: Backtraced ty -> String
$cshow :: forall ty. Show ty => Backtraced ty -> String
showsPrec :: Int -> Backtraced ty -> ShowS
$cshowsPrec :: forall ty. Show ty => Int -> Backtraced ty -> ShowS
Show,ReadPrec [Backtraced ty]
ReadPrec (Backtraced ty)
Int -> ReadS (Backtraced ty)
ReadS [Backtraced ty]
(Int -> ReadS (Backtraced ty))
-> ReadS [Backtraced ty]
-> ReadPrec (Backtraced ty)
-> ReadPrec [Backtraced ty]
-> Read (Backtraced ty)
forall ty. Read ty => ReadPrec [Backtraced ty]
forall ty. Read ty => ReadPrec (Backtraced ty)
forall ty. Read ty => Int -> ReadS (Backtraced ty)
forall ty. Read ty => ReadS [Backtraced ty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Backtraced ty]
$creadListPrec :: forall ty. Read ty => ReadPrec [Backtraced ty]
readPrec :: ReadPrec (Backtraced ty)
$creadPrec :: forall ty. Read ty => ReadPrec (Backtraced ty)
readList :: ReadS [Backtraced ty]
$creadList :: forall ty. Read ty => ReadS [Backtraced ty]
readsPrec :: Int -> ReadS (Backtraced ty)
$creadsPrec :: forall ty. Read ty => Int -> ReadS (Backtraced ty)
Read,(forall x. Backtraced ty -> Rep (Backtraced ty) x)
-> (forall x. Rep (Backtraced ty) x -> Backtraced ty)
-> Generic (Backtraced ty)
forall x. Rep (Backtraced ty) x -> Backtraced ty
forall x. Backtraced ty -> Rep (Backtraced ty) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall ty x. Rep (Backtraced ty) x -> Backtraced ty
forall ty x. Backtraced ty -> Rep (Backtraced ty) x
$cto :: forall ty x. Rep (Backtraced ty) x -> Backtraced ty
$cfrom :: forall ty x. Backtraced ty -> Rep (Backtraced ty) x
Generic,a -> Backtraced b -> Backtraced a
(a -> b) -> Backtraced a -> Backtraced b
(forall a b. (a -> b) -> Backtraced a -> Backtraced b)
-> (forall a b. a -> Backtraced b -> Backtraced a)
-> Functor Backtraced
forall a b. a -> Backtraced b -> Backtraced a
forall a b. (a -> b) -> Backtraced a -> Backtraced b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Backtraced b -> Backtraced a
$c<$ :: forall a b. a -> Backtraced b -> Backtraced a
fmap :: (a -> b) -> Backtraced a -> Backtraced b
$cfmap :: forall a b. (a -> b) -> Backtraced a -> Backtraced b
Functor,Backtraced a -> Bool
(a -> m) -> Backtraced a -> m
(a -> b -> b) -> b -> Backtraced a -> b
(forall m. Monoid m => Backtraced m -> m)
-> (forall m a. Monoid m => (a -> m) -> Backtraced a -> m)
-> (forall m a. Monoid m => (a -> m) -> Backtraced a -> m)
-> (forall a b. (a -> b -> b) -> b -> Backtraced a -> b)
-> (forall a b. (a -> b -> b) -> b -> Backtraced a -> b)
-> (forall b a. (b -> a -> b) -> b -> Backtraced a -> b)
-> (forall b a. (b -> a -> b) -> b -> Backtraced a -> b)
-> (forall a. (a -> a -> a) -> Backtraced a -> a)
-> (forall a. (a -> a -> a) -> Backtraced a -> a)
-> (forall a. Backtraced a -> [a])
-> (forall a. Backtraced a -> Bool)
-> (forall a. Backtraced a -> Int)
-> (forall a. Eq a => a -> Backtraced a -> Bool)
-> (forall a. Ord a => Backtraced a -> a)
-> (forall a. Ord a => Backtraced a -> a)
-> (forall a. Num a => Backtraced a -> a)
-> (forall a. Num a => Backtraced a -> a)
-> Foldable Backtraced
forall a. Eq a => a -> Backtraced a -> Bool
forall a. Num a => Backtraced a -> a
forall a. Ord a => Backtraced a -> a
forall m. Monoid m => Backtraced m -> m
forall a. Backtraced a -> Bool
forall a. Backtraced a -> Int
forall a. Backtraced a -> [a]
forall a. (a -> a -> a) -> Backtraced a -> a
forall m a. Monoid m => (a -> m) -> Backtraced a -> m
forall b a. (b -> a -> b) -> b -> Backtraced a -> b
forall a b. (a -> b -> b) -> b -> Backtraced 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 :: Backtraced a -> a
$cproduct :: forall a. Num a => Backtraced a -> a
sum :: Backtraced a -> a
$csum :: forall a. Num a => Backtraced a -> a
minimum :: Backtraced a -> a
$cminimum :: forall a. Ord a => Backtraced a -> a
maximum :: Backtraced a -> a
$cmaximum :: forall a. Ord a => Backtraced a -> a
elem :: a -> Backtraced a -> Bool
$celem :: forall a. Eq a => a -> Backtraced a -> Bool
length :: Backtraced a -> Int
$clength :: forall a. Backtraced a -> Int
null :: Backtraced a -> Bool
$cnull :: forall a. Backtraced a -> Bool
toList :: Backtraced a -> [a]
$ctoList :: forall a. Backtraced a -> [a]
foldl1 :: (a -> a -> a) -> Backtraced a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Backtraced a -> a
foldr1 :: (a -> a -> a) -> Backtraced a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Backtraced a -> a
foldl' :: (b -> a -> b) -> b -> Backtraced a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Backtraced a -> b
foldl :: (b -> a -> b) -> b -> Backtraced a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Backtraced a -> b
foldr' :: (a -> b -> b) -> b -> Backtraced a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Backtraced a -> b
foldr :: (a -> b -> b) -> b -> Backtraced a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Backtraced a -> b
foldMap' :: (a -> m) -> Backtraced a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Backtraced a -> m
foldMap :: (a -> m) -> Backtraced a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Backtraced a -> m
fold :: Backtraced m -> m
$cfold :: forall m. Monoid m => Backtraced m -> m
Foldable,Functor Backtraced
Foldable Backtraced
Functor Backtraced
-> Foldable Backtraced
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Backtraced a -> f (Backtraced b))
-> (forall (f :: * -> *) a.
Applicative f =>
Backtraced (f a) -> f (Backtraced a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Backtraced a -> m (Backtraced b))
-> (forall (m :: * -> *) a.
Monad m =>
Backtraced (m a) -> m (Backtraced a))
-> Traversable Backtraced
(a -> f b) -> Backtraced a -> f (Backtraced b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Backtraced (m a) -> m (Backtraced a)
forall (f :: * -> *) a.
Applicative f =>
Backtraced (f a) -> f (Backtraced a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Backtraced a -> m (Backtraced b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Backtraced a -> f (Backtraced b)
sequence :: Backtraced (m a) -> m (Backtraced a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
Backtraced (m a) -> m (Backtraced a)
mapM :: (a -> m b) -> Backtraced a -> m (Backtraced b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Backtraced a -> m (Backtraced b)
sequenceA :: Backtraced (f a) -> f (Backtraced a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Backtraced (f a) -> f (Backtraced a)
traverse :: (a -> f b) -> Backtraced a -> f (Backtraced b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Backtraced a -> f (Backtraced b)
$cp2Traversable :: Foldable Backtraced
$cp1Traversable :: Functor Backtraced
Traversable)
instance Cons (Backtraced ty) (Backtraced ty') ty ty' where
{-# Inlinable _Cons #-}
_Cons :: p (ty, Backtraced ty) (f (ty', Backtraced ty'))
-> p (Backtraced ty) (f (Backtraced ty'))
_Cons =
let go1 :: Backtraced ty -> Either (Backtraced ty) (ty, Backtraced ty)
go1 Backtraced ty
Epsilon = Backtraced ty -> Either (Backtraced ty) (ty, Backtraced ty)
forall a b. a -> Either a b
Left Backtraced ty
forall ty. Backtraced ty
Epsilon
go1 (Cons ty
x Backtraced ty
xs) = (ty, Backtraced ty) -> Either (Backtraced ty) (ty, Backtraced ty)
forall a b. b -> Either a b
Right (ty
x,Backtraced ty
xs)
go1 (Snoc Backtraced ty
xs ty
x) = Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
xs (ty -> Either ty (Backtraced ty)
forall a b. a -> Either a b
Left ty
x)
go1 (Append Backtraced ty
xs Backtraced ty
ys) = Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
xs (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right Backtraced ty
ys)
go2 :: Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
Epsilon (Left ty
y) = (ty, Backtraced ty) -> Either (Backtraced ty) (ty, Backtraced ty)
forall a b. b -> Either a b
Right (ty
y,Backtraced ty
forall ty. Backtraced ty
Epsilon)
go2 Backtraced ty
Epsilon (Right Backtraced ty
ys) = Backtraced ty -> Either (Backtraced ty) (ty, Backtraced ty)
go1 Backtraced ty
ys
go2 (Cons ty
x Backtraced ty
xs) (Left ty
y) = (ty, Backtraced ty) -> Either (Backtraced ty) (ty, Backtraced ty)
forall a b. b -> Either a b
Right (ty
x,Backtraced ty -> ty -> Backtraced ty
forall ty. Backtraced ty -> ty -> Backtraced ty
Snoc Backtraced ty
xs ty
y)
go2 (Cons ty
x Backtraced ty
xs) (Right Backtraced ty
ys) = (ty, Backtraced ty) -> Either (Backtraced ty) (ty, Backtraced ty)
forall a b. b -> Either a b
Right (ty
x, Backtraced ty -> Backtraced ty -> Backtraced ty
forall ty. Backtraced ty -> Backtraced ty -> Backtraced ty
Append Backtraced ty
xs Backtraced ty
ys)
go2 (Snoc Backtraced ty
xs ty
x) (Left ty
y) = Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
xs (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ ty
x ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
`Cons` Backtraced ty
forall ty. Backtraced ty
Epsilon Backtraced ty -> ty -> Backtraced ty
forall ty. Backtraced ty -> ty -> Backtraced ty
`Snoc` ty
y)
go2 (Snoc Backtraced ty
xs ty
x) (Right Backtraced ty
ys) = Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
xs (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ ty
x ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
`Cons` Backtraced ty
ys)
go2 (Append Backtraced ty
xs Backtraced ty
ys) (Left ty
z) = Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
xs (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ Backtraced ty
ys Backtraced ty -> ty -> Backtraced ty
forall ty. Backtraced ty -> ty -> Backtraced ty
`Snoc` ty
z)
go2 (Append Backtraced ty
xs Backtraced ty
ys) (Right Backtraced ty
zs) = Backtraced ty
-> Either ty (Backtraced ty)
-> Either (Backtraced ty) (ty, Backtraced ty)
go2 Backtraced ty
xs (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ Backtraced ty
ys Backtraced ty -> Backtraced ty -> Backtraced ty
forall ty. Backtraced ty -> Backtraced ty -> Backtraced ty
`Append` Backtraced ty
zs)
in ((ty', Backtraced ty') -> Backtraced ty')
-> (Backtraced ty -> Either (Backtraced ty') (ty, Backtraced ty))
-> Prism
(Backtraced ty)
(Backtraced ty')
(ty, Backtraced ty)
(ty', Backtraced ty')
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism ((ty' -> Backtraced ty' -> Backtraced ty')
-> (ty', Backtraced ty') -> Backtraced ty'
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ty' -> Backtraced ty' -> Backtraced ty'
forall ty. ty -> Backtraced ty -> Backtraced ty
Cons) Backtraced ty -> Either (Backtraced ty') (ty, Backtraced ty)
forall ty ty.
Backtraced ty -> Either (Backtraced ty) (ty, Backtraced ty)
go1
instance Snoc (Backtraced ty) (Backtraced ty') ty ty' where
{-# Inlinable _Snoc #-}
_Snoc :: p (Backtraced ty, ty) (f (Backtraced ty', ty'))
-> p (Backtraced ty) (f (Backtraced ty'))
_Snoc =
let go1 :: Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go1 Backtraced ty
Epsilon = Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
forall a b. a -> Either a b
Left Backtraced ty
forall ty. Backtraced ty
Epsilon
go1 (Cons ty
x Backtraced ty
xs) = Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (ty -> Either ty (Backtraced ty)
forall a b. a -> Either a b
Left ty
x) Backtraced ty
xs
go1 (Snoc Backtraced ty
xs ty
x) = (Backtraced ty, ty) -> Either (Backtraced ty) (Backtraced ty, ty)
forall a b. b -> Either a b
Right (Backtraced ty
xs,ty
x)
go1 (Append Backtraced ty
xs Backtraced ty
ys) = Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right Backtraced ty
xs) Backtraced ty
ys
go2 :: Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (Left ty
x) Backtraced ty
Epsilon = (Backtraced ty, ty) -> Either (Backtraced ty) (Backtraced ty, ty)
forall a b. b -> Either a b
Right (Backtraced ty
forall ty. Backtraced ty
Epsilon,ty
x)
go2 (Right Backtraced ty
xs) Backtraced ty
Epsilon = Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go1 Backtraced ty
xs
go2 (Left ty
x) (Cons ty
y Backtraced ty
ys) = Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ ty
x ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
`Cons` (ty
y ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
`Cons` Backtraced ty
forall ty. Backtraced ty
Epsilon)) Backtraced ty
ys
go2 (Right Backtraced ty
xs) (Cons ty
y Backtraced ty
ys) = Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ Backtraced ty
xs Backtraced ty -> ty -> Backtraced ty
forall ty. Backtraced ty -> ty -> Backtraced ty
`Snoc` ty
y) Backtraced ty
ys
go2 (Left ty
x) (Snoc Backtraced ty
ys ty
y) = (Backtraced ty, ty) -> Either (Backtraced ty) (Backtraced ty, ty)
forall a b. b -> Either a b
Right (ty
x ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
`Cons` Backtraced ty
ys, ty
y)
go2 (Right Backtraced ty
xs) (Snoc Backtraced ty
ys ty
y) = (Backtraced ty, ty) -> Either (Backtraced ty) (Backtraced ty, ty)
forall a b. b -> Either a b
Right (Backtraced ty
xs Backtraced ty -> Backtraced ty -> Backtraced ty
forall ty. Backtraced ty -> Backtraced ty -> Backtraced ty
`Append` Backtraced ty
ys, ty
y)
go2 (Left ty
x) (Append Backtraced ty
ys Backtraced ty
zs) = Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ ty
x ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
`Cons` Backtraced ty
ys) Backtraced ty
zs
go2 (Right Backtraced ty
xs) (Append Backtraced ty
ys Backtraced ty
zs) = Either ty (Backtraced ty)
-> Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go2 (Backtraced ty -> Either ty (Backtraced ty)
forall a b. b -> Either a b
Right (Backtraced ty -> Either ty (Backtraced ty))
-> Backtraced ty -> Either ty (Backtraced ty)
forall a b. (a -> b) -> a -> b
$ Backtraced ty
xs Backtraced ty -> Backtraced ty -> Backtraced ty
forall ty. Backtraced ty -> Backtraced ty -> Backtraced ty
`Append` Backtraced ty
ys) Backtraced ty
zs
in ((Backtraced ty', ty') -> Backtraced ty')
-> (Backtraced ty -> Either (Backtraced ty') (Backtraced ty, ty))
-> Prism
(Backtraced ty)
(Backtraced ty')
(Backtraced ty, ty)
(Backtraced ty', ty')
forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism ((Backtraced ty' -> ty' -> Backtraced ty')
-> (Backtraced ty', ty') -> Backtraced ty'
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Backtraced ty' -> ty' -> Backtraced ty'
forall ty. Backtraced ty -> ty -> Backtraced ty
Snoc) Backtraced ty -> Either (Backtraced ty') (Backtraced ty, ty)
forall ty ty.
Backtraced ty -> Either (Backtraced ty) (Backtraced ty, ty)
go1
<| :: ty -> Backtraced ty -> Backtraced ty
(<|) = ty -> Backtraced ty -> Backtraced ty
forall ty. ty -> Backtraced ty -> Backtraced ty
Cons
|> :: Backtraced ty -> ty -> Backtraced ty
(|>) = Backtraced ty -> ty -> Backtraced ty
forall ty. Backtraced ty -> ty -> Backtraced ty
Snoc
>< :: Backtraced ty -> Backtraced ty -> Backtraced ty
(><) = Backtraced ty -> Backtraced ty -> Backtraced ty
forall ty. Backtraced ty -> Backtraced ty -> Backtraced ty
Append
infixr 5 <|
infixr 5 ><
infixl 5 |>
instance SC.Serial m a ⇒ SC.Serial m (Backtraced a)