{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE EmptyDataDeriving #-}
module Predicate.Data.Elr (
ENone'
, ELeft'
, ERight'
, EBoth'
, ElrIn
, ElrId
, ElrPair
, ElrInSimple
, PartitionElr
, ENoneDef
, ELeftDef
, ERightDef
, EBothDef
, MkENone
, MkELeft
, MkERight
, MkEBoth
, MkENone'
, MkELeft'
, MkERight'
, IsENone
, IsELeft
, IsERight
, IsEBoth
, These2Elr
, Elr2These
, Elr2Maybe
) where
import Predicate.Core
import Predicate.Util
import Predicate.Elr
import Data.Kind (Type)
import Control.Lens
import Data.Proxy (Proxy(..))
import Data.These (These)
data MkENone' t t1 deriving Int -> MkENone' t t1 -> ShowS
[MkENone' t t1] -> ShowS
MkENone' t t1 -> String
(Int -> MkENone' t t1 -> ShowS)
-> (MkENone' t t1 -> String)
-> ([MkENone' t t1] -> ShowS)
-> Show (MkENone' t t1)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (t :: k) k (t1 :: k). Int -> MkENone' t t1 -> ShowS
forall k (t :: k) k (t1 :: k). [MkENone' t t1] -> ShowS
forall k (t :: k) k (t1 :: k). MkENone' t t1 -> String
showList :: [MkENone' t t1] -> ShowS
$cshowList :: forall k (t :: k) k (t1 :: k). [MkENone' t t1] -> ShowS
show :: MkENone' t t1 -> String
$cshow :: forall k (t :: k) k (t1 :: k). MkENone' t t1 -> String
showsPrec :: Int -> MkENone' t t1 -> ShowS
$cshowsPrec :: forall k (t :: k) k (t1 :: k). Int -> MkENone' t t1 -> ShowS
Show
instance P (MkENone' t t1) x where
type PP (MkENone' t t1) x = Elr (PP t x) (PP t1 x)
eval :: proxy (MkENone' t t1)
-> POpts -> x -> m (TT (PP (MkENone' t t1) x))
eval proxy (MkENone' t t1)
_ POpts
opts x
_ =
let msg0 :: String
msg0 = String
"MkENone"
d :: Elr a b
d = Elr a b
forall a b. Elr a b
ENone
in TT (Elr (PP t x) (PP t1 x)) -> m (TT (Elr (PP t x) (PP t1 x)))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Elr (PP t x) (PP t1 x)) -> m (TT (Elr (PP t x) (PP t1 x))))
-> TT (Elr (PP t x) (PP t1 x)) -> m (TT (Elr (PP t x) (PP t1 x)))
forall a b. (a -> b) -> a -> b
$ POpts
-> Val (Elr (PP t x) (PP t1 x))
-> String
-> [Tree PE]
-> TT (Elr (PP t x) (PP t1 x))
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (Elr (PP t x) (PP t1 x) -> Val (Elr (PP t x) (PP t1 x))
forall a. a -> Val a
Val Elr (PP t x) (PP t1 x)
forall a b. Elr a b
d) String
msg0 []
data MkENone (t :: Type) (t1 :: Type) deriving Int -> MkENone t t1 -> ShowS
[MkENone t t1] -> ShowS
MkENone t t1 -> String
(Int -> MkENone t t1 -> ShowS)
-> (MkENone t t1 -> String)
-> ([MkENone t t1] -> ShowS)
-> Show (MkENone t t1)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall t t1. Int -> MkENone t t1 -> ShowS
forall t t1. [MkENone t t1] -> ShowS
forall t t1. MkENone t t1 -> String
showList :: [MkENone t t1] -> ShowS
$cshowList :: forall t t1. [MkENone t t1] -> ShowS
show :: MkENone t t1 -> String
$cshow :: forall t t1. MkENone t t1 -> String
showsPrec :: Int -> MkENone t t1 -> ShowS
$cshowsPrec :: forall t t1. Int -> MkENone t t1 -> ShowS
Show
type MkENoneT (t :: Type) (t1 :: Type) = MkENone' (Hole t) (Hole t1)
instance P (MkENone t t1) x where
type PP (MkENone t t1) x = PP (MkENoneT t t1) x
eval :: proxy (MkENone t t1) -> POpts -> x -> m (TT (PP (MkENone t t1) x))
eval proxy (MkENone t t1)
_ = Proxy (MkENoneT t t1)
-> POpts -> x -> m (TT (PP (MkENoneT t t1) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (MkENoneT t t1)
forall k (t :: k). Proxy t
Proxy @(MkENoneT t t1))
data MkELeft' t p deriving Int -> MkELeft' t p -> ShowS
[MkELeft' t p] -> ShowS
MkELeft' t p -> String
(Int -> MkELeft' t p -> ShowS)
-> (MkELeft' t p -> String)
-> ([MkELeft' t p] -> ShowS)
-> Show (MkELeft' t p)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (t :: k) k (p :: k). Int -> MkELeft' t p -> ShowS
forall k (t :: k) k (p :: k). [MkELeft' t p] -> ShowS
forall k (t :: k) k (p :: k). MkELeft' t p -> String
showList :: [MkELeft' t p] -> ShowS
$cshowList :: forall k (t :: k) k (p :: k). [MkELeft' t p] -> ShowS
show :: MkELeft' t p -> String
$cshow :: forall k (t :: k) k (p :: k). MkELeft' t p -> String
showsPrec :: Int -> MkELeft' t p -> ShowS
$cshowsPrec :: forall k (t :: k) k (p :: k). Int -> MkELeft' t p -> ShowS
Show
instance P p x
=> P (MkELeft' t p) x where
type PP (MkELeft' t p) x = Elr (PP p x) (PP t x)
eval :: proxy (MkELeft' t p) -> POpts -> x -> m (TT (PP (MkELeft' t p) x))
eval proxy (MkELeft' t p)
_ POpts
opts x
x = do
let msg0 :: String
msg0 = String
"MkELeft"
TT (PP p x)
pp <- Proxy p -> POpts -> x -> m (TT (PP p x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy p
forall k (t :: k). Proxy t
Proxy @p) POpts
opts x
x
TT (Elr (PP p x) (PP t x)) -> m (TT (Elr (PP p x) (PP t x)))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Elr (PP p x) (PP t x)) -> m (TT (Elr (PP p x) (PP t x))))
-> TT (Elr (PP p x) (PP t x)) -> m (TT (Elr (PP p x) (PP t x)))
forall a b. (a -> b) -> a -> b
$ case Inline
-> POpts
-> String
-> TT (PP p x)
-> [Tree PE]
-> Either (TT (Elr (PP p x) (PP t x))) (PP p x)
forall a x.
Inline -> POpts -> String -> TT a -> [Tree PE] -> Either (TT x) a
getValueLR Inline
NoInline POpts
opts String
msg0 TT (PP p x)
pp [] of
Left TT (Elr (PP p x) (PP t x))
e -> TT (Elr (PP p x) (PP t x))
e
Right PP p x
p ->
let d :: Elr (PP p x) (PP t x)
d = PP p x -> Elr (PP p x) (PP t x)
forall a b. a -> Elr a b
ELeft PP p x
p
in POpts
-> Val (Elr (PP p x) (PP t x))
-> String
-> [Tree PE]
-> TT (Elr (PP p x) (PP t x))
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (Elr (PP p x) (PP t x) -> Val (Elr (PP p x) (PP t x))
forall a. a -> Val a
Val Elr (PP p x) (PP t x)
d) String
msg0 [TT (PP p x) -> Tree PE
forall a. TT a -> Tree PE
hh TT (PP p x)
pp]
data MkELeft (t :: Type) p deriving Int -> MkELeft t p -> ShowS
[MkELeft t p] -> ShowS
MkELeft t p -> String
(Int -> MkELeft t p -> ShowS)
-> (MkELeft t p -> String)
-> ([MkELeft t p] -> ShowS)
-> Show (MkELeft t p)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall t k (p :: k). Int -> MkELeft t p -> ShowS
forall t k (p :: k). [MkELeft t p] -> ShowS
forall t k (p :: k). MkELeft t p -> String
showList :: [MkELeft t p] -> ShowS
$cshowList :: forall t k (p :: k). [MkELeft t p] -> ShowS
show :: MkELeft t p -> String
$cshow :: forall t k (p :: k). MkELeft t p -> String
showsPrec :: Int -> MkELeft t p -> ShowS
$cshowsPrec :: forall t k (p :: k). Int -> MkELeft t p -> ShowS
Show
type MkELeftT (t :: Type) p = MkELeft' (Hole t) p
instance P (MkELeftT t p) x => P (MkELeft t p) x where
type PP (MkELeft t p) x = PP (MkELeftT t p) x
eval :: proxy (MkELeft t p) -> POpts -> x -> m (TT (PP (MkELeft t p) x))
eval proxy (MkELeft t p)
_ = Proxy (MkELeftT t p) -> POpts -> x -> m (TT (PP (MkELeftT t p) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (MkELeftT t p)
forall k (t :: k). Proxy t
Proxy @(MkELeftT t p))
data MkERight' t p deriving Int -> MkERight' t p -> ShowS
[MkERight' t p] -> ShowS
MkERight' t p -> String
(Int -> MkERight' t p -> ShowS)
-> (MkERight' t p -> String)
-> ([MkERight' t p] -> ShowS)
-> Show (MkERight' t p)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (t :: k) k (p :: k). Int -> MkERight' t p -> ShowS
forall k (t :: k) k (p :: k). [MkERight' t p] -> ShowS
forall k (t :: k) k (p :: k). MkERight' t p -> String
showList :: [MkERight' t p] -> ShowS
$cshowList :: forall k (t :: k) k (p :: k). [MkERight' t p] -> ShowS
show :: MkERight' t p -> String
$cshow :: forall k (t :: k) k (p :: k). MkERight' t p -> String
showsPrec :: Int -> MkERight' t p -> ShowS
$cshowsPrec :: forall k (t :: k) k (p :: k). Int -> MkERight' t p -> ShowS
Show
instance P p x
=> P (MkERight' t p) x where
type PP (MkERight' t p) x = Elr (PP t x) (PP p x)
eval :: proxy (MkERight' t p)
-> POpts -> x -> m (TT (PP (MkERight' t p) x))
eval proxy (MkERight' t p)
_ POpts
opts x
x = do
let msg0 :: String
msg0 = String
"MkERight"
TT (PP p x)
pp <- Proxy p -> POpts -> x -> m (TT (PP p x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy p
forall k (t :: k). Proxy t
Proxy @p) POpts
opts x
x
TT (Elr (PP t x) (PP p x)) -> m (TT (Elr (PP t x) (PP p x)))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Elr (PP t x) (PP p x)) -> m (TT (Elr (PP t x) (PP p x))))
-> TT (Elr (PP t x) (PP p x)) -> m (TT (Elr (PP t x) (PP p x)))
forall a b. (a -> b) -> a -> b
$ case Inline
-> POpts
-> String
-> TT (PP p x)
-> [Tree PE]
-> Either (TT (Elr (PP t x) (PP p x))) (PP p x)
forall a x.
Inline -> POpts -> String -> TT a -> [Tree PE] -> Either (TT x) a
getValueLR Inline
NoInline POpts
opts String
msg0 TT (PP p x)
pp [] of
Left TT (Elr (PP t x) (PP p x))
e -> TT (Elr (PP t x) (PP p x))
e
Right PP p x
p ->
let d :: Elr (PP t x) (PP p x)
d = PP p x -> Elr (PP t x) (PP p x)
forall a b. b -> Elr a b
ERight PP p x
p
in POpts
-> Val (Elr (PP t x) (PP p x))
-> String
-> [Tree PE]
-> TT (Elr (PP t x) (PP p x))
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (Elr (PP t x) (PP p x) -> Val (Elr (PP t x) (PP p x))
forall a. a -> Val a
Val Elr (PP t x) (PP p x)
d) String
msg0 [TT (PP p x) -> Tree PE
forall a. TT a -> Tree PE
hh TT (PP p x)
pp]
data MkERight (t :: Type) p deriving Int -> MkERight t p -> ShowS
[MkERight t p] -> ShowS
MkERight t p -> String
(Int -> MkERight t p -> ShowS)
-> (MkERight t p -> String)
-> ([MkERight t p] -> ShowS)
-> Show (MkERight t p)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall t k (p :: k). Int -> MkERight t p -> ShowS
forall t k (p :: k). [MkERight t p] -> ShowS
forall t k (p :: k). MkERight t p -> String
showList :: [MkERight t p] -> ShowS
$cshowList :: forall t k (p :: k). [MkERight t p] -> ShowS
show :: MkERight t p -> String
$cshow :: forall t k (p :: k). MkERight t p -> String
showsPrec :: Int -> MkERight t p -> ShowS
$cshowsPrec :: forall t k (p :: k). Int -> MkERight t p -> ShowS
Show
type MkERightT (t :: Type) p = MkERight' (Hole t) p
instance P (MkERightT t p) x => P (MkERight t p) x where
type PP (MkERight t p) x = PP (MkERightT t p) x
eval :: proxy (MkERight t p) -> POpts -> x -> m (TT (PP (MkERight t p) x))
eval proxy (MkERight t p)
_ = Proxy (MkERightT t p)
-> POpts -> x -> m (TT (PP (MkERightT t p) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (MkERightT t p)
forall k (t :: k). Proxy t
Proxy @(MkERightT t p))
data MkEBoth p q deriving Int -> MkEBoth p q -> ShowS
[MkEBoth p q] -> ShowS
MkEBoth p q -> String
(Int -> MkEBoth p q -> ShowS)
-> (MkEBoth p q -> String)
-> ([MkEBoth p q] -> ShowS)
-> Show (MkEBoth p q)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k) k (q :: k). Int -> MkEBoth p q -> ShowS
forall k (p :: k) k (q :: k). [MkEBoth p q] -> ShowS
forall k (p :: k) k (q :: k). MkEBoth p q -> String
showList :: [MkEBoth p q] -> ShowS
$cshowList :: forall k (p :: k) k (q :: k). [MkEBoth p q] -> ShowS
show :: MkEBoth p q -> String
$cshow :: forall k (p :: k) k (q :: k). MkEBoth p q -> String
showsPrec :: Int -> MkEBoth p q -> ShowS
$cshowsPrec :: forall k (p :: k) k (q :: k). Int -> MkEBoth p q -> ShowS
Show
instance ( P p a
, P q a
) => P (MkEBoth p q) a where
type PP (MkEBoth p q) a = Elr (PP p a) (PP q a)
eval :: proxy (MkEBoth p q) -> POpts -> a -> m (TT (PP (MkEBoth p q) a))
eval proxy (MkEBoth p q)
_ POpts
opts a
a = do
let msg0 :: String
msg0 = String
"MkEBoth"
Either
(TT (Elr (PP p a) (PP q a)))
(PP p a, PP q a, TT (PP p a), TT (PP q a))
lr <- Inline
-> String
-> Proxy p
-> Proxy q
-> POpts
-> a
-> [Tree PE]
-> m (Either
(TT (Elr (PP p a) (PP q a)))
(PP p a, PP q a, TT (PP p a), TT (PP q a)))
forall k1 k2 (p :: k1) a (q :: k2) (m :: Type -> Type)
(proxy1 :: k1 -> Type) (proxy2 :: k2 -> Type) x.
(P p a, P q a, MonadEval m) =>
Inline
-> String
-> proxy1 p
-> proxy2 q
-> POpts
-> a
-> [Tree PE]
-> m (Either (TT x) (PP p a, PP q a, TT (PP p a), TT (PP q a)))
runPQ Inline
NoInline String
msg0 (Proxy p
forall k (t :: k). Proxy t
Proxy @p) (Proxy q
forall k (t :: k). Proxy t
Proxy @q) POpts
opts a
a []
TT (Elr (PP p a) (PP q a)) -> m (TT (Elr (PP p a) (PP q a)))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Elr (PP p a) (PP q a)) -> m (TT (Elr (PP p a) (PP q a))))
-> TT (Elr (PP p a) (PP q a)) -> m (TT (Elr (PP p a) (PP q a)))
forall a b. (a -> b) -> a -> b
$ case Either
(TT (Elr (PP p a) (PP q a)))
(PP p a, PP q a, TT (PP p a), TT (PP q a))
lr of
Left TT (Elr (PP p a) (PP q a))
e -> TT (Elr (PP p a) (PP q a))
e
Right (PP p a
p,PP q a
q,TT (PP p a)
pp,TT (PP q a)
qq) ->
let d :: Elr (PP p a) (PP q a)
d = PP p a -> PP q a -> Elr (PP p a) (PP q a)
forall a b. a -> b -> Elr a b
EBoth PP p a
p PP q a
q
in POpts
-> Val (Elr (PP p a) (PP q a))
-> String
-> [Tree PE]
-> TT (Elr (PP p a) (PP q a))
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (Elr (PP p a) (PP q a) -> Val (Elr (PP p a) (PP q a))
forall a. a -> Val a
Val Elr (PP p a) (PP q a)
d) String
msg0 [TT (PP p a) -> Tree PE
forall a. TT a -> Tree PE
hh TT (PP p a)
pp, TT (PP q a) -> Tree PE
forall a. TT a -> Tree PE
hh TT (PP q a)
qq]
data IsElr (th :: Elr x y) deriving Int -> IsElr th -> ShowS
[IsElr th] -> ShowS
IsElr th -> String
(Int -> IsElr th -> ShowS)
-> (IsElr th -> String) -> ([IsElr th] -> ShowS) -> Show (IsElr th)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall x y (th :: Elr x y). Int -> IsElr th -> ShowS
forall x y (th :: Elr x y). [IsElr th] -> ShowS
forall x y (th :: Elr x y). IsElr th -> String
showList :: [IsElr th] -> ShowS
$cshowList :: forall x y (th :: Elr x y). [IsElr th] -> ShowS
show :: IsElr th -> String
$cshow :: forall x y (th :: Elr x y). IsElr th -> String
showsPrec :: Int -> IsElr th -> ShowS
$cshowsPrec :: forall x y (th :: Elr x y). Int -> IsElr th -> ShowS
Show
instance ( x ~ Elr a b
, Show a
, Show b
, GetElr th
) => P (IsElr (th :: Elr x1 x2)) x where
type PP (IsElr th) x = Bool
eval :: proxy (IsElr th) -> POpts -> x -> m (TT (PP (IsElr th) x))
eval proxy (IsElr th)
_ POpts
opts x
x =
let msg0 :: String
msg0 = String
"Is"
th :: Elr () ()
th = GetElr th => Elr () ()
forall k k1 (th :: Elr k k1). GetElr th => Elr () ()
getElr @th
fn :: Elr a b -> Bool
fn = case Elr () ()
th of
Elr () ()
ENone -> Elr a b -> Bool
forall a b. Elr a b -> Bool
isENone
ELeft () -> Elr a b -> Bool
forall a b. Elr a b -> Bool
isELeft
ERight () -> Elr a b -> Bool
forall a b. Elr a b -> Bool
isERight
EBoth () () -> Elr a b -> Bool
forall a b. Elr a b -> Bool
isEBoth
b :: Bool
b = Elr a b -> Bool
fn x
Elr a b
x
in TT Bool -> m (TT Bool)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT Bool -> m (TT Bool)) -> TT Bool -> m (TT Bool)
forall a b. (a -> b) -> a -> b
$ POpts -> Bool -> String -> [Tree PE] -> TT Bool
mkNodeB POpts
opts Bool
b (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Elr () () -> String
forall a b. Elr a b -> String
showElr Elr () ()
th String -> ShowS
forall a. Semigroup a => a -> a -> a
<> POpts -> String -> x -> String
forall a. Show a => POpts -> String -> a -> String
showVerbose POpts
opts String
" | " x
x) []
data IsENone deriving Int -> IsENone -> ShowS
[IsENone] -> ShowS
IsENone -> String
(Int -> IsENone -> ShowS)
-> (IsENone -> String) -> ([IsENone] -> ShowS) -> Show IsENone
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsENone] -> ShowS
$cshowList :: [IsENone] -> ShowS
show :: IsENone -> String
$cshow :: IsENone -> String
showsPrec :: Int -> IsENone -> ShowS
$cshowsPrec :: Int -> IsENone -> ShowS
Show
type IsENoneT = IsElr 'ENone
instance P IsENoneT x => P IsENone x where
type PP IsENone x = PP IsENoneT x
eval :: proxy IsENone -> POpts -> x -> m (TT (PP IsENone x))
eval proxy IsENone
_ = Proxy IsENoneT -> POpts -> x -> m (TT (PP IsENoneT x))
forall k (m :: Type -> Type) (p :: k) a (proxy :: k -> Type).
(MonadEval m, P p a, PP p a ~ Bool) =>
proxy p -> POpts -> a -> m (TT (PP p a))
evalBool (Proxy IsENoneT
forall k (t :: k). Proxy t
Proxy @IsENoneT)
data IsELeft deriving Int -> IsELeft -> ShowS
[IsELeft] -> ShowS
IsELeft -> String
(Int -> IsELeft -> ShowS)
-> (IsELeft -> String) -> ([IsELeft] -> ShowS) -> Show IsELeft
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsELeft] -> ShowS
$cshowList :: [IsELeft] -> ShowS
show :: IsELeft -> String
$cshow :: IsELeft -> String
showsPrec :: Int -> IsELeft -> ShowS
$cshowsPrec :: Int -> IsELeft -> ShowS
Show
type IsELeftT = IsElr ('ELeft '())
instance P IsELeftT x => P IsELeft x where
type PP IsELeft x = PP IsELeftT x
eval :: proxy IsELeft -> POpts -> x -> m (TT (PP IsELeft x))
eval proxy IsELeft
_ = Proxy IsELeftT -> POpts -> x -> m (TT (PP IsELeftT x))
forall k (m :: Type -> Type) (p :: k) a (proxy :: k -> Type).
(MonadEval m, P p a, PP p a ~ Bool) =>
proxy p -> POpts -> a -> m (TT (PP p a))
evalBool (Proxy IsELeftT
forall k (t :: k). Proxy t
Proxy @IsELeftT)
data IsERight deriving Int -> IsERight -> ShowS
[IsERight] -> ShowS
IsERight -> String
(Int -> IsERight -> ShowS)
-> (IsERight -> String) -> ([IsERight] -> ShowS) -> Show IsERight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsERight] -> ShowS
$cshowList :: [IsERight] -> ShowS
show :: IsERight -> String
$cshow :: IsERight -> String
showsPrec :: Int -> IsERight -> ShowS
$cshowsPrec :: Int -> IsERight -> ShowS
Show
type IsERightT = IsElr ('ERight '())
instance P IsERightT x => P IsERight x where
type PP IsERight x = PP IsERightT x
eval :: proxy IsERight -> POpts -> x -> m (TT (PP IsERight x))
eval proxy IsERight
_ = Proxy IsERightT -> POpts -> x -> m (TT (PP IsERightT x))
forall k (m :: Type -> Type) (p :: k) a (proxy :: k -> Type).
(MonadEval m, P p a, PP p a ~ Bool) =>
proxy p -> POpts -> a -> m (TT (PP p a))
evalBool (Proxy IsERightT
forall k (t :: k). Proxy t
Proxy @IsERightT)
data IsEBoth deriving Int -> IsEBoth -> ShowS
[IsEBoth] -> ShowS
IsEBoth -> String
(Int -> IsEBoth -> ShowS)
-> (IsEBoth -> String) -> ([IsEBoth] -> ShowS) -> Show IsEBoth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IsEBoth] -> ShowS
$cshowList :: [IsEBoth] -> ShowS
show :: IsEBoth -> String
$cshow :: IsEBoth -> String
showsPrec :: Int -> IsEBoth -> ShowS
$cshowsPrec :: Int -> IsEBoth -> ShowS
Show
type IsEBothT = IsElr ('EBoth '() '())
instance P IsEBothT x => P IsEBoth x where
type PP IsEBoth x = PP IsEBothT x
eval :: proxy IsEBoth -> POpts -> x -> m (TT (PP IsEBoth x))
eval proxy IsEBoth
_ = Proxy IsEBothT -> POpts -> x -> m (TT (PP IsEBothT x))
forall k (m :: Type -> Type) (p :: k) a (proxy :: k -> Type).
(MonadEval m, P p a, PP p a ~ Bool) =>
proxy p -> POpts -> a -> m (TT (PP p a))
evalBool (Proxy IsEBothT
forall k (t :: k). Proxy t
Proxy @IsEBothT)
data ENone' deriving Int -> ENone' -> ShowS
[ENone'] -> ShowS
ENone' -> String
(Int -> ENone' -> ShowS)
-> (ENone' -> String) -> ([ENone'] -> ShowS) -> Show ENone'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ENone'] -> ShowS
$cshowList :: [ENone'] -> ShowS
show :: ENone' -> String
$cshow :: ENone' -> String
showsPrec :: Int -> ENone' -> ShowS
$cshowsPrec :: Int -> ENone' -> ShowS
Show
instance P ENone' (Elr x y) where
type PP ENone' (Elr x y) = ()
eval :: proxy ENone' -> POpts -> Elr x y -> m (TT (PP ENone' (Elr x y)))
eval proxy ENone'
_ POpts
opts Elr x y
lr =
let msg0 :: String
msg0 = String
"ENone'"
in TT () -> m (TT ())
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT () -> m (TT ())) -> TT () -> m (TT ())
forall a b. (a -> b) -> a -> b
$ case Elr x y
lr of
Elr x y
ENone -> POpts -> Val () -> String -> [Tree PE] -> TT ()
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (() -> Val ()
forall a. a -> Val a
Val ()) String
msg0 []
Elr x y
_ -> POpts -> Val () -> String -> [Tree PE] -> TT ()
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (String -> Val ()
forall a. String -> Val a
Fail (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" found " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Elr x y -> String
forall a b. Elr a b -> String
showElr Elr x y
lr)) String
"" []
data ELeft' deriving Int -> ELeft' -> ShowS
[ELeft'] -> ShowS
ELeft' -> String
(Int -> ELeft' -> ShowS)
-> (ELeft' -> String) -> ([ELeft'] -> ShowS) -> Show ELeft'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ELeft'] -> ShowS
$cshowList :: [ELeft'] -> ShowS
show :: ELeft' -> String
$cshow :: ELeft' -> String
showsPrec :: Int -> ELeft' -> ShowS
$cshowsPrec :: Int -> ELeft' -> ShowS
Show
instance Show a => P ELeft' (Elr a x) where
type PP ELeft' (Elr a x) = a
eval :: proxy ELeft' -> POpts -> Elr a x -> m (TT (PP ELeft' (Elr a x)))
eval proxy ELeft'
_ POpts
opts Elr a x
lr =
let msg0 :: String
msg0 = String
"ELeft'"
in TT a -> m (TT a)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT a -> m (TT a)) -> TT a -> m (TT a)
forall a b. (a -> b) -> a -> b
$ case Elr a x
lr of
ELeft a
a -> POpts -> Val a -> String -> [Tree PE] -> TT a
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (a -> Val a
forall a. a -> Val a
Val a
a) (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> POpts -> a -> String
forall a. Show a => POpts -> a -> String
showL POpts
opts a
a) []
Elr a x
_ -> POpts -> Val a -> String -> [Tree PE] -> TT a
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (String -> Val a
forall a. String -> Val a
Fail (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" found " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Elr a x -> String
forall a b. Elr a b -> String
showElr Elr a x
lr)) String
"" []
data ERight' deriving Int -> ERight' -> ShowS
[ERight'] -> ShowS
ERight' -> String
(Int -> ERight' -> ShowS)
-> (ERight' -> String) -> ([ERight'] -> ShowS) -> Show ERight'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ERight'] -> ShowS
$cshowList :: [ERight'] -> ShowS
show :: ERight' -> String
$cshow :: ERight' -> String
showsPrec :: Int -> ERight' -> ShowS
$cshowsPrec :: Int -> ERight' -> ShowS
Show
instance Show a => P ERight' (Elr x a) where
type PP ERight' (Elr x a) = a
eval :: proxy ERight' -> POpts -> Elr x a -> m (TT (PP ERight' (Elr x a)))
eval proxy ERight'
_ POpts
opts Elr x a
lr =
let msg0 :: String
msg0 = String
"ERight'"
in TT a -> m (TT a)
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT a -> m (TT a)) -> TT a -> m (TT a)
forall a b. (a -> b) -> a -> b
$ case Elr x a
lr of
ERight a
a -> POpts -> Val a -> String -> [Tree PE] -> TT a
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (a -> Val a
forall a. a -> Val a
Val a
a) (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> POpts -> a -> String
forall a. Show a => POpts -> a -> String
showL POpts
opts a
a) []
Elr x a
_ -> POpts -> Val a -> String -> [Tree PE] -> TT a
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (String -> Val a
forall a. String -> Val a
Fail (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" found " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Elr x a -> String
forall a b. Elr a b -> String
showElr Elr x a
lr)) String
"" []
data EBoth' deriving Int -> EBoth' -> ShowS
[EBoth'] -> ShowS
EBoth' -> String
(Int -> EBoth' -> ShowS)
-> (EBoth' -> String) -> ([EBoth'] -> ShowS) -> Show EBoth'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EBoth'] -> ShowS
$cshowList :: [EBoth'] -> ShowS
show :: EBoth' -> String
$cshow :: EBoth' -> String
showsPrec :: Int -> EBoth' -> ShowS
$cshowsPrec :: Int -> EBoth' -> ShowS
Show
instance ( Show a
, Show b
) => P EBoth' (Elr a b) where
type PP EBoth' (Elr a b) = (a,b)
eval :: proxy EBoth' -> POpts -> Elr a b -> m (TT (PP EBoth' (Elr a b)))
eval proxy EBoth'
_ POpts
opts Elr a b
lr =
let msg0 :: String
msg0 = String
"EBoth'"
in TT (a, b) -> m (TT (a, b))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (a, b) -> m (TT (a, b))) -> TT (a, b) -> m (TT (a, b))
forall a b. (a -> b) -> a -> b
$ case Elr a b
lr of
EBoth a
a b
b -> POpts -> Val (a, b) -> String -> [Tree PE] -> TT (a, b)
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts ((a, b) -> Val (a, b)
forall a. a -> Val a
Val (a
a,b
b)) (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> POpts -> (a, b) -> String
forall a. Show a => POpts -> a -> String
showL POpts
opts (a
a,b
b)) []
Elr a b
_ -> POpts -> Val (a, b) -> String -> [Tree PE] -> TT (a, b)
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (String -> Val (a, b)
forall a. String -> Val a
Fail (String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" found " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Elr a b -> String
forall a b. Elr a b -> String
showElr Elr a b
lr)) String
"" []
data PartitionElr deriving Int -> PartitionElr -> ShowS
[PartitionElr] -> ShowS
PartitionElr -> String
(Int -> PartitionElr -> ShowS)
-> (PartitionElr -> String)
-> ([PartitionElr] -> ShowS)
-> Show PartitionElr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartitionElr] -> ShowS
$cshowList :: [PartitionElr] -> ShowS
show :: PartitionElr -> String
$cshow :: PartitionElr -> String
showsPrec :: Int -> PartitionElr -> ShowS
$cshowsPrec :: Int -> PartitionElr -> ShowS
Show
instance ( Show a
, Show b
) => P PartitionElr [Elr a b] where
type PP PartitionElr [Elr a b] = ([()], [a], [b], [(a, b)])
eval :: proxy PartitionElr
-> POpts -> [Elr a b] -> m (TT (PP PartitionElr [Elr a b]))
eval proxy PartitionElr
_ POpts
opts [Elr a b]
as =
let msg0 :: String
msg0 = String
"PartitionElr"
b :: ([()], [a], [b], [(a, b)])
b = [Elr a b] -> ([()], [a], [b], [(a, b)])
forall a b. [Elr a b] -> ([()], [a], [b], [(a, b)])
partitionElr [Elr a b]
as
in TT ([()], [a], [b], [(a, b)]) -> m (TT ([()], [a], [b], [(a, b)]))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT ([()], [a], [b], [(a, b)])
-> m (TT ([()], [a], [b], [(a, b)])))
-> TT ([()], [a], [b], [(a, b)])
-> m (TT ([()], [a], [b], [(a, b)]))
forall a b. (a -> b) -> a -> b
$ POpts
-> Val ([()], [a], [b], [(a, b)])
-> String
-> [Tree PE]
-> TT ([()], [a], [b], [(a, b)])
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (([()], [a], [b], [(a, b)]) -> Val ([()], [a], [b], [(a, b)])
forall a. a -> Val a
Val ([()], [a], [b], [(a, b)])
b) (POpts
-> String -> ([()], [a], [b], [(a, b)]) -> [Elr a b] -> String
forall a1 a2.
(Show a1, Show a2) =>
POpts -> String -> a1 -> a2 -> String
show3 POpts
opts String
msg0 ([()], [a], [b], [(a, b)])
b [Elr a b]
as) []
data ElrIn n p q r s t deriving Int -> ElrIn n p q r s t -> ShowS
[ElrIn n p q r s t] -> ShowS
ElrIn n p q r s t -> String
(Int -> ElrIn n p q r s t -> ShowS)
-> (ElrIn n p q r s t -> String)
-> ([ElrIn n p q r s t] -> ShowS)
-> Show (ElrIn n p q r s t)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k) k (s :: k) k
(t :: k).
Int -> ElrIn n p q r s t -> ShowS
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k) k (s :: k) k
(t :: k).
[ElrIn n p q r s t] -> ShowS
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k) k (s :: k) k
(t :: k).
ElrIn n p q r s t -> String
showList :: [ElrIn n p q r s t] -> ShowS
$cshowList :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k) k (s :: k) k
(t :: k).
[ElrIn n p q r s t] -> ShowS
show :: ElrIn n p q r s t -> String
$cshow :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k) k (s :: k) k
(t :: k).
ElrIn n p q r s t -> String
showsPrec :: Int -> ElrIn n p q r s t -> ShowS
$cshowsPrec :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k) k (s :: k) k
(t :: k).
Int -> ElrIn n p q r s t -> ShowS
Show
instance ( Show a
, Show b
, Show (PP r (y,(a,b)))
, P n y
, P p (y,a)
, P q (y,b)
, P r (y,(a,b))
, PP n y ~ PP p (y,a)
, PP p (y,a) ~ PP q (y,b)
, PP q (y,b) ~ PP r (y,(a,b))
, P s x
, P t x
, PP t x ~ Elr a b
, PP s x ~ y
) => P (ElrIn n p q r s t) x where
type PP (ElrIn n p q r s t) x = PP n (PP s x)
eval :: proxy (ElrIn n p q r s t)
-> POpts -> x -> m (TT (PP (ElrIn n p q r s t) x))
eval proxy (ElrIn n p q r s t)
_ POpts
opts x
x = do
let msg0 :: String
msg0 = String
"ElrIn"
Either (TT (PP r (y, (a, b)))) (y, Elr a b, TT y, TT (Elr a b))
lr <- Inline
-> String
-> Proxy s
-> Proxy t
-> POpts
-> x
-> [Tree PE]
-> m (Either
(TT (PP r (y, (a, b)))) (PP s x, PP t x, TT (PP s x), TT (PP t x)))
forall k1 k2 (p :: k1) a (q :: k2) (m :: Type -> Type)
(proxy1 :: k1 -> Type) (proxy2 :: k2 -> Type) x.
(P p a, P q a, MonadEval m) =>
Inline
-> String
-> proxy1 p
-> proxy2 q
-> POpts
-> a
-> [Tree PE]
-> m (Either (TT x) (PP p a, PP q a, TT (PP p a), TT (PP q a)))
runPQ Inline
NoInline String
msg0 (Proxy s
forall k (t :: k). Proxy t
Proxy @s) (Proxy t
forall k (t :: k). Proxy t
Proxy @t) POpts
opts x
x []
case Either (TT (PP r (y, (a, b)))) (y, Elr a b, TT y, TT (Elr a b))
lr of
Left TT (PP r (y, (a, b)))
e -> TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure TT (PP r (y, (a, b)))
e
Right (y
s,Elr a b
t,TT y
ss,TT (Elr a b)
tt) -> do
let hhs :: [Tree PE]
hhs = [TT y -> Tree PE
forall a. TT a -> Tree PE
hh TT y
ss, TT (Elr a b) -> Tree PE
forall a. TT a -> Tree PE
hh TT (Elr a b)
tt]
case Elr a b
t of
Elr a b
ENone -> do
let msg1 :: String
msg1 = String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"(ENone)"
TT (PP r (y, (a, b)))
nn <- Proxy n -> POpts -> y -> m (TT (PP n y))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy n
forall k (t :: k). Proxy t
Proxy @n) POpts
opts y
s
TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b)))))
-> TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall a b. (a -> b) -> a -> b
$ case Inline
-> POpts
-> String
-> TT (PP r (y, (a, b)))
-> [Tree PE]
-> Either (TT (PP r (y, (a, b)))) (PP r (y, (a, b)))
forall a x.
Inline -> POpts -> String -> TT a -> [Tree PE] -> Either (TT x) a
getValueLR Inline
NoInline POpts
opts (String
msg1 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" n failed") TT (PP r (y, (a, b)))
nn [Tree PE]
hhs of
Left TT (PP r (y, (a, b)))
e -> TT (PP r (y, (a, b)))
e
Right PP r (y, (a, b))
c -> POpts
-> TT (PP r (y, (a, b)))
-> String
-> [Tree PE]
-> TT (PP r (y, (a, b)))
forall a. POpts -> TT a -> String -> [Tree PE] -> TT a
mkNodeCopy POpts
opts TT (PP r (y, (a, b)))
nn (POpts -> String -> PP r (y, (a, b)) -> () -> String
forall a1 a2.
(Show a1, Show a2) =>
POpts -> String -> a1 -> a2 -> String
show3 POpts
opts String
msg1 PP r (y, (a, b))
c ()) [Tree PE]
hhs
ELeft a
a -> do
let msg1 :: String
msg1 = String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"(ELeft)"
TT (PP r (y, (a, b)))
pp <- Proxy p -> POpts -> (y, a) -> m (TT (PP p (y, a)))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy p
forall k (t :: k). Proxy t
Proxy @p) POpts
opts (y
s,a
a)
TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b)))))
-> TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall a b. (a -> b) -> a -> b
$ case Inline
-> POpts
-> String
-> TT (PP r (y, (a, b)))
-> [Tree PE]
-> Either (TT (PP r (y, (a, b)))) (PP r (y, (a, b)))
forall a x.
Inline -> POpts -> String -> TT a -> [Tree PE] -> Either (TT x) a
getValueLR Inline
NoInline POpts
opts (String
msg1 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" p failed") TT (PP r (y, (a, b)))
pp [Tree PE]
hhs of
Left TT (PP r (y, (a, b)))
e -> TT (PP r (y, (a, b)))
e
Right PP r (y, (a, b))
c -> POpts
-> TT (PP r (y, (a, b)))
-> String
-> [Tree PE]
-> TT (PP r (y, (a, b)))
forall a. POpts -> TT a -> String -> [Tree PE] -> TT a
mkNodeCopy POpts
opts TT (PP r (y, (a, b)))
pp (POpts -> String -> PP r (y, (a, b)) -> a -> String
forall a1 a2.
(Show a1, Show a2) =>
POpts -> String -> a1 -> a2 -> String
show3 POpts
opts String
msg1 PP r (y, (a, b))
c a
a) [Tree PE]
hhs
ERight b
b -> do
let msg1 :: String
msg1 = String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"(ERight)"
TT (PP r (y, (a, b)))
qq <- Proxy q -> POpts -> (y, b) -> m (TT (PP q (y, b)))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy q
forall k (t :: k). Proxy t
Proxy @q) POpts
opts (y
s,b
b)
TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b)))))
-> TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall a b. (a -> b) -> a -> b
$ case Inline
-> POpts
-> String
-> TT (PP r (y, (a, b)))
-> [Tree PE]
-> Either (TT (PP r (y, (a, b)))) (PP r (y, (a, b)))
forall a x.
Inline -> POpts -> String -> TT a -> [Tree PE] -> Either (TT x) a
getValueLR Inline
NoInline POpts
opts (String
msg1 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" q failed") TT (PP r (y, (a, b)))
qq [Tree PE]
hhs of
Left TT (PP r (y, (a, b)))
e -> TT (PP r (y, (a, b)))
e
Right PP r (y, (a, b))
c -> POpts
-> TT (PP r (y, (a, b)))
-> String
-> [Tree PE]
-> TT (PP r (y, (a, b)))
forall a. POpts -> TT a -> String -> [Tree PE] -> TT a
mkNodeCopy POpts
opts TT (PP r (y, (a, b)))
qq (POpts -> String -> PP r (y, (a, b)) -> b -> String
forall a1 a2.
(Show a1, Show a2) =>
POpts -> String -> a1 -> a2 -> String
show3 POpts
opts String
msg1 PP r (y, (a, b))
c b
b) [Tree PE]
hhs
EBoth a
a b
b -> do
let msg1 :: String
msg1 = String
msg0 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
"(EBoth)"
TT (PP r (y, (a, b)))
rr <- Proxy r -> POpts -> (y, (a, b)) -> m (TT (PP r (y, (a, b))))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy r
forall k (t :: k). Proxy t
Proxy @r) POpts
opts (y
s,(a
a,b
b))
TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b)))))
-> TT (PP r (y, (a, b))) -> m (TT (PP r (y, (a, b))))
forall a b. (a -> b) -> a -> b
$ case Inline
-> POpts
-> String
-> TT (PP r (y, (a, b)))
-> [Tree PE]
-> Either (TT (PP r (y, (a, b)))) (PP r (y, (a, b)))
forall a x.
Inline -> POpts -> String -> TT a -> [Tree PE] -> Either (TT x) a
getValueLR Inline
NoInline POpts
opts (String
msg1 String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" r failed") TT (PP r (y, (a, b)))
rr [Tree PE]
hhs of
Left TT (PP r (y, (a, b)))
e -> TT (PP r (y, (a, b)))
e
Right PP r (y, (a, b))
c -> POpts
-> TT (PP r (y, (a, b)))
-> String
-> [Tree PE]
-> TT (PP r (y, (a, b)))
forall a. POpts -> TT a -> String -> [Tree PE] -> TT a
mkNodeCopy POpts
opts TT (PP r (y, (a, b)))
rr (POpts -> String -> PP r (y, (a, b)) -> (a, b) -> String
forall a1 a2.
(Show a1, Show a2) =>
POpts -> String -> a1 -> a2 -> String
show3 POpts
opts String
msg1 PP r (y, (a, b))
c (a
a,b
b)) [Tree PE]
hhs
data ElrId n p q r deriving Int -> ElrId n p q r -> ShowS
[ElrId n p q r] -> ShowS
ElrId n p q r -> String
(Int -> ElrId n p q r -> ShowS)
-> (ElrId n p q r -> String)
-> ([ElrId n p q r] -> ShowS)
-> Show (ElrId n p q r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
Int -> ElrId n p q r -> ShowS
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
[ElrId n p q r] -> ShowS
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
ElrId n p q r -> String
showList :: [ElrId n p q r] -> ShowS
$cshowList :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
[ElrId n p q r] -> ShowS
show :: ElrId n p q r -> String
$cshow :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
ElrId n p q r -> String
showsPrec :: Int -> ElrId n p q r -> ShowS
$cshowsPrec :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
Int -> ElrId n p q r -> ShowS
Show
type ElrIdT n p q r = ElrIn n (Snd >> p) (Snd >> q) (Snd >> r) () Id
instance P (ElrIdT n p q r) x => P (ElrId n p q r) x where
type PP (ElrId n p q r) x = PP (ElrIdT n p q r) x
eval :: proxy (ElrId n p q r)
-> POpts -> x -> m (TT (PP (ElrId n p q r) x))
eval proxy (ElrId n p q r)
_ = Proxy (ElrIdT n p q r)
-> POpts -> x -> m (TT (PP (ElrIdT n p q r) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (ElrIdT n p q r)
forall k (t :: k). Proxy t
Proxy @(ElrIdT n p q r))
data ElrPair s t deriving Int -> ElrPair s t -> ShowS
[ElrPair s t] -> ShowS
ElrPair s t -> String
(Int -> ElrPair s t -> ShowS)
-> (ElrPair s t -> String)
-> ([ElrPair s t] -> ShowS)
-> Show (ElrPair s t)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (s :: k) k (t :: k). Int -> ElrPair s t -> ShowS
forall k (s :: k) k (t :: k). [ElrPair s t] -> ShowS
forall k (s :: k) k (t :: k). ElrPair s t -> String
showList :: [ElrPair s t] -> ShowS
$cshowList :: forall k (s :: k) k (t :: k). [ElrPair s t] -> ShowS
show :: ElrPair s t -> String
$cshow :: forall k (s :: k) k (t :: k). ElrPair s t -> String
showsPrec :: Int -> ElrPair s t -> ShowS
$cshowsPrec :: forall k (s :: k) k (t :: k). Int -> ElrPair s t -> ShowS
Show
type ElrPairT s t = ElrIn Id '(Snd,L12) '(L11,Snd) Snd s t
instance P (ElrPairT s t) x => P (ElrPair s t) x where
type PP (ElrPair s t) x = PP (ElrPairT s t) x
eval :: proxy (ElrPair s t) -> POpts -> x -> m (TT (PP (ElrPair s t) x))
eval proxy (ElrPair s t)
_ = Proxy (ElrPairT s t) -> POpts -> x -> m (TT (PP (ElrPairT s t) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (ElrPairT s t)
forall k (t :: k). Proxy t
Proxy @(ElrPairT s t))
data ElrInSimple n p q r deriving Int -> ElrInSimple n p q r -> ShowS
[ElrInSimple n p q r] -> ShowS
ElrInSimple n p q r -> String
(Int -> ElrInSimple n p q r -> ShowS)
-> (ElrInSimple n p q r -> String)
-> ([ElrInSimple n p q r] -> ShowS)
-> Show (ElrInSimple n p q r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
Int -> ElrInSimple n p q r -> ShowS
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
[ElrInSimple n p q r] -> ShowS
forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
ElrInSimple n p q r -> String
showList :: [ElrInSimple n p q r] -> ShowS
$cshowList :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
[ElrInSimple n p q r] -> ShowS
show :: ElrInSimple n p q r -> String
$cshow :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
ElrInSimple n p q r -> String
showsPrec :: Int -> ElrInSimple n p q r -> ShowS
$cshowsPrec :: forall k (n :: k) k (p :: k) k (q :: k) k (r :: k).
Int -> ElrInSimple n p q r -> ShowS
Show
type ElrInSimpleT n p q r = ElrIn n (Snd >> p) (Snd >> q) (Snd >> r) () Id
instance P (ElrInSimpleT n p q r) x => P (ElrInSimple n p q r) x where
type PP (ElrInSimple n p q r) x = PP (ElrInSimpleT n p q r) x
eval :: proxy (ElrInSimple n p q r)
-> POpts -> x -> m (TT (PP (ElrInSimple n p q r) x))
eval proxy (ElrInSimple n p q r)
_ = Proxy (ElrInSimpleT n p q r)
-> POpts -> x -> m (TT (PP (ElrInSimpleT n p q r) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (ElrInSimpleT n p q r)
forall k (t :: k). Proxy t
Proxy @(ElrInSimpleT n p q r))
data ENoneDef p q r deriving Int -> ENoneDef p q r -> ShowS
[ENoneDef p q r] -> ShowS
ENoneDef p q r -> String
(Int -> ENoneDef p q r -> ShowS)
-> (ENoneDef p q r -> String)
-> ([ENoneDef p q r] -> ShowS)
-> Show (ENoneDef p q r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k) k (q :: k) k (r :: k).
Int -> ENoneDef p q r -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). [ENoneDef p q r] -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). ENoneDef p q r -> String
showList :: [ENoneDef p q r] -> ShowS
$cshowList :: forall k (p :: k) k (q :: k) k (r :: k). [ENoneDef p q r] -> ShowS
show :: ENoneDef p q r -> String
$cshow :: forall k (p :: k) k (q :: k) k (r :: k). ENoneDef p q r -> String
showsPrec :: Int -> ENoneDef p q r -> ShowS
$cshowsPrec :: forall k (p :: k) k (q :: k) k (r :: k).
Int -> ENoneDef p q r -> ShowS
Show
type ENoneDefT p q r = ElrIn Id (Fst >> p) (Fst >> p) (Fst >> p) q r
instance P (ENoneDefT p q r) x => P (ENoneDef p q r) x where
type PP (ENoneDef p q r) x = PP (ENoneDefT p q r) x
eval :: proxy (ENoneDef p q r)
-> POpts -> x -> m (TT (PP (ENoneDef p q r) x))
eval proxy (ENoneDef p q r)
_ = Proxy (ENoneDefT p q r)
-> POpts -> x -> m (TT (PP (ENoneDefT p q r) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (ENoneDefT p q r)
forall k (t :: k). Proxy t
Proxy @(ENoneDefT p q r))
data ELeftDef p q r deriving Int -> ELeftDef p q r -> ShowS
[ELeftDef p q r] -> ShowS
ELeftDef p q r -> String
(Int -> ELeftDef p q r -> ShowS)
-> (ELeftDef p q r -> String)
-> ([ELeftDef p q r] -> ShowS)
-> Show (ELeftDef p q r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k) k (q :: k) k (r :: k).
Int -> ELeftDef p q r -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). [ELeftDef p q r] -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). ELeftDef p q r -> String
showList :: [ELeftDef p q r] -> ShowS
$cshowList :: forall k (p :: k) k (q :: k) k (r :: k). [ELeftDef p q r] -> ShowS
show :: ELeftDef p q r -> String
$cshow :: forall k (p :: k) k (q :: k) k (r :: k). ELeftDef p q r -> String
showsPrec :: Int -> ELeftDef p q r -> ShowS
$cshowsPrec :: forall k (p :: k) k (q :: k) k (r :: k).
Int -> ELeftDef p q r -> ShowS
Show
type ELeftDefT p q r = ElrIn p Snd (Fst >> p) (Fst >> p) q r
instance P (ELeftDefT p q r) x => P (ELeftDef p q r) x where
type PP (ELeftDef p q r) x = PP (ELeftDefT p q r) x
eval :: proxy (ELeftDef p q r)
-> POpts -> x -> m (TT (PP (ELeftDef p q r) x))
eval proxy (ELeftDef p q r)
_ = Proxy (ELeftDefT p q r)
-> POpts -> x -> m (TT (PP (ELeftDefT p q r) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (ELeftDefT p q r)
forall k (t :: k). Proxy t
Proxy @(ELeftDefT p q r))
data ERightDef p q r deriving Int -> ERightDef p q r -> ShowS
[ERightDef p q r] -> ShowS
ERightDef p q r -> String
(Int -> ERightDef p q r -> ShowS)
-> (ERightDef p q r -> String)
-> ([ERightDef p q r] -> ShowS)
-> Show (ERightDef p q r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k) k (q :: k) k (r :: k).
Int -> ERightDef p q r -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). [ERightDef p q r] -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). ERightDef p q r -> String
showList :: [ERightDef p q r] -> ShowS
$cshowList :: forall k (p :: k) k (q :: k) k (r :: k). [ERightDef p q r] -> ShowS
show :: ERightDef p q r -> String
$cshow :: forall k (p :: k) k (q :: k) k (r :: k). ERightDef p q r -> String
showsPrec :: Int -> ERightDef p q r -> ShowS
$cshowsPrec :: forall k (p :: k) k (q :: k) k (r :: k).
Int -> ERightDef p q r -> ShowS
Show
type ERightDefT p q r = ElrIn p (Fst >> p) Snd (Fst >> p) q r
instance P (ERightDefT p q r) x => P (ERightDef p q r) x where
type PP (ERightDef p q r) x = PP (ERightDefT p q r) x
eval :: proxy (ERightDef p q r)
-> POpts -> x -> m (TT (PP (ERightDef p q r) x))
eval proxy (ERightDef p q r)
_ = Proxy (ERightDefT p q r)
-> POpts -> x -> m (TT (PP (ERightDefT p q r) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (ERightDefT p q r)
forall k (t :: k). Proxy t
Proxy @(ERightDefT p q r))
data EBothDef p q r deriving Int -> EBothDef p q r -> ShowS
[EBothDef p q r] -> ShowS
EBothDef p q r -> String
(Int -> EBothDef p q r -> ShowS)
-> (EBothDef p q r -> String)
-> ([EBothDef p q r] -> ShowS)
-> Show (EBothDef p q r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k) k (q :: k) k (r :: k).
Int -> EBothDef p q r -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). [EBothDef p q r] -> ShowS
forall k (p :: k) k (q :: k) k (r :: k). EBothDef p q r -> String
showList :: [EBothDef p q r] -> ShowS
$cshowList :: forall k (p :: k) k (q :: k) k (r :: k). [EBothDef p q r] -> ShowS
show :: EBothDef p q r -> String
$cshow :: forall k (p :: k) k (q :: k) k (r :: k). EBothDef p q r -> String
showsPrec :: Int -> EBothDef p q r -> ShowS
$cshowsPrec :: forall k (p :: k) k (q :: k) k (r :: k).
Int -> EBothDef p q r -> ShowS
Show
type EBothDefT p q r = ElrIn p (Fst >> p) (Fst >> p) Snd q r
instance P (EBothDefT p q r) x => P (EBothDef p q r) x where
type PP (EBothDef p q r) x = PP (EBothDefT p q r) x
eval :: proxy (EBothDef p q r)
-> POpts -> x -> m (TT (PP (EBothDef p q r) x))
eval proxy (EBothDef p q r)
_ = Proxy (EBothDefT p q r)
-> POpts -> x -> m (TT (PP (EBothDefT p q r) x))
forall k (p :: k) a (m :: Type -> Type) (proxy :: k -> Type).
(P p a, MonadEval m) =>
proxy p -> POpts -> a -> m (TT (PP p a))
eval (Proxy (EBothDefT p q r)
forall k (t :: k). Proxy t
Proxy @(EBothDefT p q r))
data Elr2These deriving Int -> Elr2These -> ShowS
[Elr2These] -> ShowS
Elr2These -> String
(Int -> Elr2These -> ShowS)
-> (Elr2These -> String)
-> ([Elr2These] -> ShowS)
-> Show Elr2These
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Elr2These] -> ShowS
$cshowList :: [Elr2These] -> ShowS
show :: Elr2These -> String
$cshow :: Elr2These -> String
showsPrec :: Int -> Elr2These -> ShowS
$cshowsPrec :: Int -> Elr2These -> ShowS
Show
instance P Elr2These (Elr a b) where
type PP Elr2These (Elr a b) = Maybe (These a b)
eval :: proxy Elr2These
-> POpts -> Elr a b -> m (TT (PP Elr2These (Elr a b)))
eval proxy Elr2These
_ POpts
opts Elr a b
x =
let msg0 :: String
msg0 = String
"Elr2These"
b :: Maybe (These a b)
b = Elr a b
x Elr a b
-> Getting (Maybe (These a b)) (Elr a b) (Maybe (These a b))
-> Maybe (These a b)
forall s a. s -> Getting a s a -> a
^. Getting (Maybe (These a b)) (Elr a b) (Maybe (These a b))
forall a b a' b'.
Iso (Elr a b) (Elr a' b') (Maybe (These a b)) (Maybe (These a' b'))
_elr2These
in TT (Maybe (These a b)) -> m (TT (Maybe (These a b)))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Maybe (These a b)) -> m (TT (Maybe (These a b))))
-> TT (Maybe (These a b)) -> m (TT (Maybe (These a b)))
forall a b. (a -> b) -> a -> b
$ POpts
-> Val (Maybe (These a b))
-> String
-> [Tree PE]
-> TT (Maybe (These a b))
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (Maybe (These a b) -> Val (Maybe (These a b))
forall a. a -> Val a
Val Maybe (These a b)
b) String
msg0 []
data These2Elr deriving Int -> These2Elr -> ShowS
[These2Elr] -> ShowS
These2Elr -> String
(Int -> These2Elr -> ShowS)
-> (These2Elr -> String)
-> ([These2Elr] -> ShowS)
-> Show These2Elr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [These2Elr] -> ShowS
$cshowList :: [These2Elr] -> ShowS
show :: These2Elr -> String
$cshow :: These2Elr -> String
showsPrec :: Int -> These2Elr -> ShowS
$cshowsPrec :: Int -> These2Elr -> ShowS
Show
instance P These2Elr (These a b) where
type PP These2Elr (These a b) = Elr a b
eval :: proxy These2Elr
-> POpts -> These a b -> m (TT (PP These2Elr (These a b)))
eval proxy These2Elr
_ POpts
opts These a b
x =
let msg0 :: String
msg0 = String
"These2Elr"
b :: Elr a b
b = Tagged (Maybe (These a b)) (Identity (Maybe (These a b)))
-> Tagged (Elr a b) (Identity (Elr a b))
forall a b a' b'.
Iso (Elr a b) (Elr a' b') (Maybe (These a b)) (Maybe (These a' b'))
_elr2These (Tagged (Maybe (These a b)) (Identity (Maybe (These a b)))
-> Tagged (Elr a b) (Identity (Elr a b)))
-> Maybe (These a b) -> Elr a b
forall t b. AReview t b -> b -> t
# These a b -> Maybe (These a b)
forall a. a -> Maybe a
Just These a b
x
in TT (Elr a b) -> m (TT (Elr a b))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Elr a b) -> m (TT (Elr a b)))
-> TT (Elr a b) -> m (TT (Elr a b))
forall a b. (a -> b) -> a -> b
$ POpts -> Val (Elr a b) -> String -> [Tree PE] -> TT (Elr a b)
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts (Elr a b -> Val (Elr a b)
forall a. a -> Val a
Val Elr a b
b) String
msg0 []
data Elr2Maybe deriving Int -> Elr2Maybe -> ShowS
[Elr2Maybe] -> ShowS
Elr2Maybe -> String
(Int -> Elr2Maybe -> ShowS)
-> (Elr2Maybe -> String)
-> ([Elr2Maybe] -> ShowS)
-> Show Elr2Maybe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Elr2Maybe] -> ShowS
$cshowList :: [Elr2Maybe] -> ShowS
show :: Elr2Maybe -> String
$cshow :: Elr2Maybe -> String
showsPrec :: Int -> Elr2Maybe -> ShowS
$cshowsPrec :: Int -> Elr2Maybe -> ShowS
Show
instance P Elr2Maybe (Elr a b) where
type PP Elr2Maybe (Elr a b) = (Maybe a, Maybe b)
eval :: proxy Elr2Maybe
-> POpts -> Elr a b -> m (TT (PP Elr2Maybe (Elr a b)))
eval proxy Elr2Maybe
_ POpts
opts Elr a b
x =
let msg0 :: String
msg0 = String
"Elr2Maybe"
b :: (Maybe a, Maybe b)
b = Elr a b
x Elr a b
-> Getting (Maybe a, Maybe b) (Elr a b) (Maybe a, Maybe b)
-> (Maybe a, Maybe b)
forall s a. s -> Getting a s a -> a
^. Getting (Maybe a, Maybe b) (Elr a b) (Maybe a, Maybe b)
forall a b a' b'.
Iso (Elr a b) (Elr a' b') (Maybe a, Maybe b) (Maybe a', Maybe b')
_elr2Maybe
in TT (Maybe a, Maybe b) -> m (TT (Maybe a, Maybe b))
forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (TT (Maybe a, Maybe b) -> m (TT (Maybe a, Maybe b)))
-> TT (Maybe a, Maybe b) -> m (TT (Maybe a, Maybe b))
forall a b. (a -> b) -> a -> b
$ POpts
-> Val (Maybe a, Maybe b)
-> String
-> [Tree PE]
-> TT (Maybe a, Maybe b)
forall a. POpts -> Val a -> String -> [Tree PE] -> TT a
mkNode POpts
opts ((Maybe a, Maybe b) -> Val (Maybe a, Maybe b)
forall a. a -> Val a
Val (Maybe a, Maybe b)
b) String
msg0 []