module Plutarch.Either (PEither (PLeft, PRight)) where

import GHC.Generics (Generic)
import Plutarch (
  DPTStrat,
  DerivePlutusType,
  PType,
  PlutusType,
  PlutusTypeScott,
  S,
  Term,
 )
import Plutarch.Bool (PEq)
import Plutarch.Show (PShow)

data PEither (a :: PType) (b :: PType) (s :: S)
  = PLeft (Term s a)
  | PRight (Term s b)
  deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (a :: PType) (b :: PType) (s :: S) x.
Rep (PEither a b s) x -> PEither a b s
forall (a :: PType) (b :: PType) (s :: S) x.
PEither a b s -> Rep (PEither a b s) x
$cto :: forall (a :: PType) (b :: PType) (s :: S) x.
Rep (PEither a b s) x -> PEither a b s
$cfrom :: forall (a :: PType) (b :: PType) (s :: S) x.
PEither a b s -> Rep (PEither a b s) x
Generic)
  deriving anyclass (forall (a :: PType).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: PType).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
forall (a :: PType) (b :: PType) (s :: S).
PEither a b s -> Term s (PInner (PEither a b))
forall (a :: PType) (b :: PType) (s :: S) (b :: PType).
Term s (PInner (PEither a b))
-> (PEither a b s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner (PEither a b))
-> (PEither a b s -> Term s b) -> Term s b
$cpmatch' :: forall (a :: PType) (b :: PType) (s :: S) (b :: PType).
Term s (PInner (PEither a b))
-> (PEither a b s -> Term s b) -> Term s b
pcon' :: forall (s :: S). PEither a b s -> Term s (PInner (PEither a b))
$cpcon' :: forall (a :: PType) (b :: PType) (s :: S).
PEither a b s -> Term s (PInner (PEither a b))
PlutusType, forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
forall (a :: PType) (b :: PType) (s :: S).
(PEq a, PEq b) =>
Term s (PEither a b) -> Term s (PEither a b) -> Term s PBool
#== :: forall (s :: S).
Term s (PEither a b) -> Term s (PEither a b) -> Term s PBool
$c#== :: forall (a :: PType) (b :: PType) (s :: S).
(PEq a, PEq b) =>
Term s (PEither a b) -> Term s (PEither a b) -> Term s PBool
PEq, forall (t :: PType).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
forall (a :: PType) (b :: PType) (s :: S).
(PShow a, PShow b) =>
Bool -> Term s (PEither a b) -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s (PEither a b) -> Term s PString
$cpshow' :: forall (a :: PType) (b :: PType) (s :: S).
(PShow a, PShow b) =>
Bool -> Term s (PEither a b) -> Term s PString
PShow)
instance DerivePlutusType (PEither a b) where type DPTStrat _ = PlutusTypeScott