{-# LANGUAGE LambdaCase            #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE TypeOperators         #-}
{-# LANGUAGE UndecidableInstances  #-}
{-# OPTIONS_GHC -Wno-orphans       #-}
module PlutusIR.Core.Instance.Pretty () where

import PlutusPrelude

import PlutusCore qualified as PLC
import PlutusCore.Flat ()
import PlutusCore.Pretty qualified as PLC

import PlutusIR.Core.Type

import Prettyprinter
import Prettyprinter.Custom

-- Pretty-printing

instance ( PLC.PrettyClassicBy configName tyname
         , PLC.PrettyClassicBy configName name
         , PLC.GShow uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty ann
         ) => PrettyBy (PLC.PrettyConfigClassic configName) (VarDecl tyname name uni fun ann) where
    prettyBy :: PrettyConfigClassic configName
-> VarDecl tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config (VarDecl ann
ann name
n Type tyname uni ann
ty) =
        Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"vardecl" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann [PrettyConfigClassic configName -> name -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config name
n, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty])

instance ( PLC.PrettyClassicBy configName tyname
         , Pretty ann
         ) => PrettyBy (PLC.PrettyConfigClassic configName) (TyVarDecl tyname ann) where
    prettyBy :: PrettyConfigClassic configName -> TyVarDecl tyname ann -> Doc ann
prettyBy PrettyConfigClassic configName
config (TyVarDecl ann
ann tyname
n Kind ann
ty) =
        Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"tyvardecl" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann [PrettyConfigClassic configName -> tyname -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config tyname
n, PrettyConfigClassic configName -> Kind ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Kind ann
ty])

instance PrettyBy (PLC.PrettyConfigClassic configName) Recursivity where
    prettyBy :: PrettyConfigClassic configName -> Recursivity -> Doc ann
prettyBy PrettyConfigClassic configName
_ = \case
        Recursivity
NonRec -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
parens Doc ann
"nonrec"
        Recursivity
Rec    -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
parens Doc ann
"rec"

instance PrettyBy (PLC.PrettyConfigClassic configName) Strictness where
    prettyBy :: PrettyConfigClassic configName -> Strictness -> Doc ann
prettyBy PrettyConfigClassic configName
_ = \case
        Strictness
NonStrict -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
parens Doc ann
"nonstrict"
        Strictness
Strict    -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
parens Doc ann
"strict"

instance ( PLC.PrettyClassicBy configName tyname
         , PLC.PrettyClassicBy configName name
         , PLC.GShow uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty ann
         ) => PrettyBy (PLC.PrettyConfigClassic configName) (Datatype tyname name uni fun ann) where
    prettyBy :: PrettyConfigClassic configName
-> Datatype tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config (Datatype ann
ann TyVarDecl tyname ann
ty [TyVarDecl tyname ann]
tyvars name
destr [VarDecl tyname name uni fun ann]
constrs) =
        Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"datatype" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
            [ PrettyConfigClassic configName -> TyVarDecl tyname ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config TyVarDecl tyname ann
ty
            , [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ (TyVarDecl tyname ann -> Doc ann)
-> [TyVarDecl tyname ann] -> [Doc ann]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrettyConfigClassic configName -> TyVarDecl tyname ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config) [TyVarDecl tyname ann]
tyvars
            , PrettyConfigClassic configName -> name -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config name
destr
            , [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep ([Doc ann] -> Doc ann) -> [Doc ann] -> Doc ann
forall a b. (a -> b) -> a -> b
$ (VarDecl tyname name uni fun ann -> Doc ann)
-> [VarDecl tyname name uni fun ann] -> [Doc ann]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrettyConfigClassic configName
-> VarDecl tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config) [VarDecl tyname name uni fun ann]
constrs
            ])

instance ( PLC.PrettyClassicBy configName tyname
         , PLC.PrettyClassicBy configName name
         , PLC.GShow uni, PLC.Closed uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty fun
         , Pretty ann
         ) => PrettyBy (PLC.PrettyConfigClassic configName) (Binding tyname name uni fun ann) where
    prettyBy :: PrettyConfigClassic configName
-> Binding tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config = \case
        TermBind ann
ann Strictness
s VarDecl tyname name uni fun ann
d Term tyname name uni fun ann
t ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"termbind" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> Strictness -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Strictness
s, PrettyConfigClassic configName
-> VarDecl tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config VarDecl tyname name uni fun ann
d, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])
        TypeBind ann
ann TyVarDecl tyname ann
d Type tyname uni ann
ty  ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"typebind" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> TyVarDecl tyname ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config TyVarDecl tyname ann
d, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty])
        DatatypeBind ann
ann Datatype tyname name uni fun ann
d ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"datatypebind" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName
-> Datatype tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Datatype tyname name uni fun ann
d])

instance ( PLC.PrettyClassicBy configName tyname
         , PLC.PrettyClassicBy configName name
         , PLC.GShow uni, PLC.Closed uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty fun
         , Pretty ann
         ) => PrettyBy (PLC.PrettyConfigClassic configName) (Term tyname name uni fun ann) where
    prettyBy :: PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config = \case
        Let ann
ann Recursivity
r NonEmpty (Binding tyname name uni fun ann)
bs Term tyname name uni fun ann
t ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"let" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> Recursivity -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Recursivity
r, [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep ([Doc ann] -> Doc ann)
-> (NonEmpty (Doc ann) -> [Doc ann])
-> NonEmpty (Doc ann)
-> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (Doc ann) -> [Doc ann]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (NonEmpty (Doc ann) -> Doc ann) -> NonEmpty (Doc ann) -> Doc ann
forall a b. (a -> b) -> a -> b
$ (Binding tyname name uni fun ann -> Doc ann)
-> NonEmpty (Binding tyname name uni fun ann) -> NonEmpty (Doc ann)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrettyConfigClassic configName
-> Binding tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config) NonEmpty (Binding tyname name uni fun ann)
bs, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])
        Var ann
ann name
n ->
            [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> name -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config name
n])
        TyAbs ann
ann tyname
tn Kind ann
k Term tyname name uni fun ann
t ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"abs" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> tyname -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config tyname
tn, PrettyConfigClassic configName -> Kind ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Kind ann
k, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])
        LamAbs ann
ann name
n Type tyname uni ann
ty Term tyname name uni fun ann
t ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"lam" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> name -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config name
n, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])
        Apply ann
ann Term tyname name uni fun ann
t1 Term tyname name uni fun ann
t2 ->
            Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
brackets' ([Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t1, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t2]))
        Constant ann
ann Some (ValueOf uni)
c ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"con" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann [Some (ValueOf uni) -> Doc ann
forall (t :: * -> *) dann. GShow t => Some (ValueOf t) -> Doc dann
prettyTypeOf Some (ValueOf uni)
c, Some (ValueOf uni) -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Some (ValueOf uni)
c])
        Builtin ann
ann fun
bi ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"builtin" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [fun -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty fun
bi])
        TyInst ann
ann Term tyname name uni fun ann
t Type tyname uni ann
ty ->
            Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
braces' ([Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty]))
        Error ann
ann Type tyname uni ann
ty ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"error" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty])
        IWrap ann
ann Type tyname uni ann
ty1 Type tyname uni ann
ty2 Term tyname name uni fun ann
t ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"iwrap" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty1, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Type tyname uni ann
ty2, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])
        Unwrap ann
ann Term tyname name uni fun ann
t ->
            Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"unwrap" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann
                [PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])
      where
        prettyTypeOf :: PLC.GShow t => PLC.Some (PLC.ValueOf t) -> Doc dann
        prettyTypeOf :: Some (ValueOf t) -> Doc dann
prettyTypeOf (PLC.Some (PLC.ValueOf t (Esc a)
uni a
_ )) = SomeTypeIn t -> Doc dann
forall a ann. Pretty a => a -> Doc ann
pretty (SomeTypeIn t -> Doc dann) -> SomeTypeIn t -> Doc dann
forall a b. (a -> b) -> a -> b
$ t (Esc a) -> SomeTypeIn t
forall (uni :: * -> *) k (a :: k). uni (Esc a) -> SomeTypeIn uni
PLC.SomeTypeIn t (Esc a)
uni


instance ( PLC.PrettyClassicBy configName tyname
         , PLC.PrettyClassicBy configName name
         , PLC.GShow uni, PLC.Closed uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty fun
         , Pretty ann
         ) => PrettyBy (PLC.PrettyConfigClassic configName) (Program tyname name uni fun ann) where
    prettyBy :: PrettyConfigClassic configName
-> Program tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config (Program ann
ann Term tyname name uni fun ann
t) =
        Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"program" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
PLC.consAnnIf PrettyConfigClassic configName
config ann
ann [PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Term tyname name uni fun ann
t])

-- See note [Default pretty instances for PLC]
instance (PLC.PrettyClassic tyname, Pretty ann) =>
    Pretty (TyVarDecl tyname ann) where
    pretty :: TyVarDecl tyname ann -> Doc ann
pretty = TyVarDecl tyname ann -> Doc ann
forall a ann. PrettyClassic a => a -> Doc ann
PLC.prettyClassicDef

instance ( PLC.PrettyClassic tyname
         , PLC.PrettyClassic name
         , PLC.GShow uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty ann
         ) => Pretty (VarDecl tyname name uni fun ann) where
    pretty :: VarDecl tyname name uni fun ann -> Doc ann
pretty = VarDecl tyname name uni fun ann -> Doc ann
forall a ann. PrettyClassic a => a -> Doc ann
PLC.prettyClassicDef

instance ( PLC.PrettyClassic tyname
         , PLC.PrettyClassic name
         , PLC.GShow uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty ann
         ) => Pretty (Datatype tyname name uni fun ann) where
    pretty :: Datatype tyname name uni fun ann -> Doc ann
pretty = Datatype tyname name uni fun ann -> Doc ann
forall a ann. PrettyClassic a => a -> Doc ann
PLC.prettyClassicDef

instance ( PLC.PrettyClassic tyname
         , PLC.PrettyClassic name
         , PLC.GShow uni, PLC.Closed uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty fun
         , Pretty ann
         ) => Pretty (Binding tyname name uni fun ann) where
    pretty :: Binding tyname name uni fun ann -> Doc ann
pretty = Binding tyname name uni fun ann -> Doc ann
forall a ann. PrettyClassic a => a -> Doc ann
PLC.prettyClassicDef

instance ( PLC.PrettyClassic tyname
         , PLC.PrettyClassic name
         , PLC.GShow uni, PLC.Closed uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty fun
         , Pretty ann
         ) => Pretty (Term tyname name uni fun ann) where
    pretty :: Term tyname name uni fun ann -> Doc ann
pretty = Term tyname name uni fun ann -> Doc ann
forall a ann. PrettyClassic a => a -> Doc ann
PLC.prettyClassicDef

instance ( PLC.PrettyClassic tyname
         , PLC.PrettyClassic name
         , PLC.GShow uni, PLC.Closed uni, uni `PLC.Everywhere` PLC.PrettyConst
         , Pretty fun
         , Pretty ann
         ) => Pretty (Program tyname name uni fun ann) where
    pretty :: Program tyname name uni fun ann -> Doc ann
pretty = Program tyname name uni fun ann -> Doc ann
forall a ann. PrettyClassic a => a -> Doc ann
PLC.prettyClassicDef