{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module PlutusCore.Core.Instance.Pretty.Classic () where
import PlutusPrelude
import PlutusCore.Core.Type
import PlutusCore.Pretty.Classic
import PlutusCore.Pretty.PrettyConst
import Prettyprinter
import Prettyprinter.Custom
import Universe
instance Pretty ann => PrettyBy (PrettyConfigClassic configName) (Kind ann) where
prettyBy :: forall ann. PrettyConfigClassic configName -> Kind ann -> Doc ann
prettyBy PrettyConfigClassic configName
config = \case
Type ann
ann ->
Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
parens ([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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[Doc ann
"type"]))
KindArrow ann
ann Kind ann
k Kind ann
k' ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"fun" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> Kind ann -> Doc ann
forall ann. 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 -> Kind ann -> Doc ann
forall ann. PrettyConfigClassic configName -> Kind ann -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config Kind ann
k'])
instance (PrettyClassicBy configName tyname, PrettyParens (SomeTypeIn uni), Pretty ann) =>
PrettyBy (PrettyConfigClassic configName) (Type tyname uni ann) where
prettyBy :: forall ann.
PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
prettyBy PrettyConfigClassic configName
config = \case
TyApp ann
ann Type tyname uni ann
t Type tyname uni ann
t' ->
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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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
t, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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
t']))
TyVar ann
ann tyname
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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> tyname -> Doc ann
forall ann. PrettyConfigClassic configName -> tyname -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config tyname
n])
TyFun ann
ann Type tyname uni ann
t Type tyname uni ann
t' ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"fun" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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
t, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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
t'])
TyIFix ann
ann Type tyname uni ann
pat Type tyname uni ann
arg ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"ifix" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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
pat, PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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
arg])
TyForall ann
ann tyname
n Kind ann
k Type tyname uni ann
t ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"all" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> tyname -> Doc ann
forall 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 ann. 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 -> Type tyname uni ann -> Doc ann
forall 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
t])
TyBuiltin ann
ann SomeTypeIn uni
someUni ->
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [RenderContext -> SomeTypeIn uni -> Doc ann
forall ann. RenderContext -> SomeTypeIn uni -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy RenderContext
juxtRenderContext SomeTypeIn uni
someUni])
TyLam ann
ann tyname
n Kind ann
k Type tyname uni 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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> tyname -> Doc ann
forall 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 ann. 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 -> Type tyname uni ann -> Doc ann
forall 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
t])
TySOP ann
ann [[Type tyname uni ann]]
tyls ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"sop" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann (([Type tyname uni ann] -> Doc ann)
-> [[Type tyname uni ann]] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [Type tyname uni ann] -> Doc ann
forall {a} {ann}.
PrettyBy (PrettyConfigClassic configName) a =>
[a] -> Doc ann
prettyTyl [[Type tyname uni ann]]
tyls))
where
prettyTyl :: [a] -> Doc ann
prettyTyl [a]
tyl = Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann
brackets ([Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
sep ((a -> Doc ann) -> [a] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrettyConfigClassic configName -> a -> Doc ann
forall ann. PrettyConfigClassic configName -> a -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy PrettyConfigClassic configName
config) [a]
tyl))
instance
( PrettyClassicBy configName tyname
, PrettyClassicBy configName name
, PrettyUni uni
, Pretty fun
, Pretty ann
) => PrettyBy (PrettyConfigClassic configName) (Term tyname name uni fun ann) where
prettyBy :: forall ann.
PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config = \case
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [PrettyConfigClassic configName -> name -> Doc ann
forall 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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> tyname -> Doc ann
forall 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 ann. 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 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])
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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> name -> Doc ann
forall 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 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, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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])
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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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 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
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [Some (ValueOf uni) -> Doc ann
forall dann. Some (ValueOf uni) -> Doc dann
prettyTypeOf Some (ValueOf uni)
c, Some (ValueOf uni) -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall dann. Some (ValueOf uni) -> Doc dann
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [fun -> Doc ann
forall 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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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 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]))
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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]
consAnnIf PrettyConfigClassic configName
config ann
ann
[PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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 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
ty2, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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])
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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])
Constr ann
ann Type tyname uni ann
ty Word64
i [Term tyname name uni fun ann]
es ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"constr" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann ([PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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, Word64 -> Doc ann
forall ann. Word64 -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Word64
i ]
[Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++ ((Term tyname name uni fun ann -> Doc ann)
-> [Term tyname name uni fun ann] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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]
es)))
Case ann
ann Type tyname uni ann
ty Term tyname name uni fun ann
arg [Term tyname name uni fun ann]
cs ->
Doc ann -> [Doc ann] -> Doc ann
forall a. Doc a -> [Doc a] -> Doc a
sexp Doc ann
"case" (PrettyConfigClassic configName -> ann -> [Doc ann] -> [Doc ann]
forall ann configName dann.
Pretty ann =>
PrettyConfigClassic configName -> ann -> [Doc dann] -> [Doc dann]
consAnnIf PrettyConfigClassic configName
config ann
ann ([PrettyConfigClassic configName -> Type tyname uni ann -> Doc ann
forall 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, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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
arg]
[Doc ann] -> [Doc ann] -> [Doc ann]
forall a. [a] -> [a] -> [a]
++ ((Term tyname name uni fun ann -> Doc ann)
-> [Term tyname name uni fun ann] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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]
cs)))
where
prettyTypeOf :: Some (ValueOf uni) -> Doc dann
prettyTypeOf :: forall dann. Some (ValueOf uni) -> Doc dann
prettyTypeOf (Some (ValueOf uni (Esc a)
uni a
_ )) = RenderContext -> SomeTypeIn uni -> Doc dann
forall ann. RenderContext -> SomeTypeIn uni -> Doc ann
forall config a ann. PrettyBy config a => config -> a -> Doc ann
prettyBy RenderContext
juxtRenderContext (SomeTypeIn uni -> Doc dann) -> SomeTypeIn uni -> Doc dann
forall a b. (a -> b) -> a -> b
$ uni (Esc a) -> SomeTypeIn uni
forall (uni :: * -> *) k (a :: k). uni (Esc a) -> SomeTypeIn uni
SomeTypeIn uni (Esc a)
uni
instance (PrettyClassicBy configName (Term tyname name uni fun ann), Pretty ann) =>
PrettyBy (PrettyConfigClassic configName) (Program tyname name uni fun ann) where
prettyBy :: forall ann.
PrettyConfigClassic configName
-> Program tyname name uni fun ann -> Doc ann
prettyBy PrettyConfigClassic configName
config (Program ann
ann Version
version Term tyname name uni fun ann
term) =
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]
consAnnIf PrettyConfigClassic configName
config ann
ann [Version -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Version -> Doc ann
pretty Version
version, PrettyConfigClassic configName
-> Term tyname name uni fun ann -> Doc ann
forall 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
term])