{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Language.EO.Phi.Pretty where
import Language.EO.Phi.Syntax.Abs as Abs
import Prettyprinter
instance Pretty Abs.Bytes where
pretty :: forall ann. Bytes -> Doc ann
pretty (Abs.Bytes String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.Function where
pretty :: forall ann. Function -> Doc ann
pretty (Abs.Function String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.LabelId where
pretty :: forall ann. LabelId -> Doc ann
pretty (Abs.LabelId String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.AlphaIndex where
pretty :: forall ann. AlphaIndex -> Doc ann
pretty (Abs.AlphaIndex String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.LabelMetaId where
pretty :: forall ann. LabelMetaId -> Doc ann
pretty (Abs.LabelMetaId String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.TailMetaId where
pretty :: forall ann. TailMetaId -> Doc ann
pretty (Abs.TailMetaId String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.BindingsMetaId where
pretty :: forall ann. BindingsMetaId -> Doc ann
pretty (Abs.BindingsMetaId String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.ObjectMetaId where
pretty :: forall ann. ObjectMetaId -> Doc ann
pretty (Abs.ObjectMetaId String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.BytesMetaId where
pretty :: forall ann. BytesMetaId -> Doc ann
pretty (Abs.BytesMetaId String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.MetaFunctionName where
pretty :: forall ann. MetaFunctionName -> Doc ann
pretty (Abs.MetaFunctionName String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.IntegerSigned where
pretty :: forall ann. IntegerSigned -> Doc ann
pretty (Abs.IntegerSigned String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.DoubleSigned where
pretty :: forall ann. DoubleSigned -> Doc ann
pretty (Abs.DoubleSigned String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
i
instance Pretty Abs.StringRaw where
pretty :: forall ann. StringRaw -> Doc ann
pretty (Abs.StringRaw String
i) = String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty (String -> String
forall a. Show a => a -> String
show String
i)
instance Pretty Abs.Program where
pretty :: forall ann. Program -> Doc ann
pretty = \case
Abs.Program [Binding]
bindings ->
[Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep
[ Doc ann
forall ann. Doc ann
lbrace
, Int -> Doc ann -> Doc ann
forall ann. Int -> Doc ann -> Doc ann
indent Int
2 (Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty ([Binding] -> Object
Formation [Binding]
bindings))
, Doc ann
forall ann. Doc ann
rbrace
]
instance Pretty Abs.MetaId where
pretty :: forall ann. MetaId -> Doc ann
pretty = \case
Abs.MetaIdLabel LabelMetaId
labelmetaid -> LabelMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. LabelMetaId -> Doc ann
pretty LabelMetaId
labelmetaid
Abs.MetaIdTail TailMetaId
tailmetaid -> TailMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. TailMetaId -> Doc ann
pretty TailMetaId
tailmetaid
Abs.MetaIdBindings BindingsMetaId
bindingsmetaid -> BindingsMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. BindingsMetaId -> Doc ann
pretty BindingsMetaId
bindingsmetaid
Abs.MetaIdObject ObjectMetaId
objectmetaid -> ObjectMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. ObjectMetaId -> Doc ann
pretty ObjectMetaId
objectmetaid
Abs.MetaIdBytes BytesMetaId
bytesmetaid -> BytesMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. BytesMetaId -> Doc ann
pretty BytesMetaId
bytesmetaid
instance Pretty Abs.Object where
pretty :: forall ann. Object -> Doc ann
pretty = \case
Abs.Formation [Binding]
bindings ->
case [Binding]
bindings of
[] -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⟦" Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⟧"
[Binding]
_ -> [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep [String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⟦", Int -> Doc ann -> Doc ann
forall ann. Int -> Doc ann -> Doc ann
indent Int
2 ([Binding] -> Doc ann
forall ann. [Binding] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [Binding]
bindings), String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⟧"]
Abs.Application Object
object [Binding]
bindings ->
case [Binding]
bindings of
[] -> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
forall ann. Doc ann
lparen Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
forall ann. Doc ann
rparen
[Binding]
_ -> [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep [Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
forall ann. Doc ann
lparen, Int -> Doc ann -> Doc ann
forall ann. Int -> Doc ann -> Doc ann
indent Int
2 ([Binding] -> Doc ann
forall ann. [Binding] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [Binding]
bindings), Doc ann
forall ann. Doc ann
rparen]
Abs.ObjectDispatch Object
object Attribute
attribute -> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"." Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Attribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Attribute -> Doc ann
pretty Attribute
attribute
Object
Abs.GlobalObject -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Φ"
Object
Abs.GlobalObjectPhiOrg -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Φ̇"
Object
Abs.ThisObject -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"ξ"
Object
Abs.Termination -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⊥"
Abs.ConstStringRaw StringRaw
str -> StringRaw -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. StringRaw -> Doc ann
pretty StringRaw
str
Abs.ConstString String
str -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty (String -> String
forall a. Show a => a -> String
show String
str)
Abs.ConstIntRaw IntegerSigned
integersigned -> IntegerSigned -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. IntegerSigned -> Doc ann
pretty IntegerSigned
integersigned
Abs.ConstFloatRaw DoubleSigned
doublesigned -> DoubleSigned -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. DoubleSigned -> Doc ann
pretty DoubleSigned
doublesigned
Abs.MetaSubstThis Object
object1 Object
object2 -> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object1 Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Doc ann
forall ann. Doc ann
lbracket Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"ξ ↦" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object2 Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Doc ann
forall ann. Doc ann
rbracket
Abs.MetaContextualize Object
object1 Object
object2 -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⌈" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object1 Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"," Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object2 Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⌉"
Abs.MetaObject ObjectMetaId
objectmetaid -> ObjectMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. ObjectMetaId -> Doc ann
pretty ObjectMetaId
objectmetaid
Abs.MetaTailContext Object
object TailMetaId
tailmetaid -> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"*" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> TailMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. TailMetaId -> Doc ann
pretty TailMetaId
tailmetaid
Abs.MetaFunction MetaFunctionName
metafunctionname Object
object -> [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep [MetaFunctionName -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. MetaFunctionName -> Doc ann
pretty MetaFunctionName
metafunctionname Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Doc ann
forall ann. Doc ann
lparen, Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object, Doc ann
forall ann. Doc ann
rparen]
Abs.ConstFloat Double
d -> Double -> Doc ann
forall ann. Double -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Double
d
Abs.ConstInt Integer
n -> Integer -> Doc ann
forall ann. Integer -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Integer
n
instance Pretty Abs.Binding where
pretty :: forall ann. Binding -> Doc ann
pretty = \case
Abs.AlphaBinding AttributeSugar
attribute Object
object -> AttributeSugar -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. AttributeSugar -> Doc ann
pretty AttributeSugar
attribute Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"↦" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object
Abs.AlphaBindingSugar Object
object -> Object -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Object -> Doc ann
pretty Object
object
Abs.EmptyBinding Attribute
attribute -> Attribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Attribute -> Doc ann
pretty Attribute
attribute Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"↦ ∅"
Abs.DeltaBinding Bytes
bytes -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Δ ⤍" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Bytes -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Bytes -> Doc ann
pretty Bytes
bytes
Binding
Abs.DeltaEmptyBinding -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Δ ⤍ ∅"
Abs.LambdaBinding Function
function -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"λ ⤍" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> Function -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Function -> Doc ann
pretty Function
function
Abs.MetaBindings BindingsMetaId
bindingsmetaid -> BindingsMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. BindingsMetaId -> Doc ann
pretty BindingsMetaId
bindingsmetaid
Abs.MetaDeltaBinding BytesMetaId
bytesmetaid -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Δ ⤍" Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> BytesMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. BytesMetaId -> Doc ann
pretty BytesMetaId
bytesmetaid
instance Pretty Abs.AttributeSugar where
pretty :: forall ann. AttributeSugar -> Doc ann
pretty = \case
Abs.AttributeSugar LabelId
labelid [Attribute]
labelids -> LabelId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. LabelId -> Doc ann
pretty LabelId
labelid Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
forall ann. Doc ann
lparen Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
hsep (Doc ann -> [Doc ann] -> [Doc ann]
forall ann. Doc ann -> [Doc ann] -> [Doc ann]
punctuate Doc ann
forall ann. Doc ann
comma (Attribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Attribute -> Doc ann
pretty (Attribute -> Doc ann) -> [Attribute] -> [Doc ann]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Attribute]
labelids)) Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
forall ann. Doc ann
rparen
Abs.AttributeNoSugar Attribute
attribute -> Attribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Attribute -> Doc ann
pretty Attribute
attribute
instance {-# OVERLAPPING #-} Pretty [Abs.Binding] where
pretty :: forall ann. [Binding] -> Doc ann
pretty = [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep ([Doc ann] -> Doc ann)
-> ([Binding] -> [Doc ann]) -> [Binding] -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc ann -> [Doc ann] -> [Doc ann]
forall ann. Doc ann -> [Doc ann] -> [Doc ann]
punctuate Doc ann
forall ann. Doc ann
comma ([Doc ann] -> [Doc ann])
-> ([Binding] -> [Doc ann]) -> [Binding] -> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Binding -> Doc ann) -> [Binding] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Binding -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Binding -> Doc ann
pretty
instance Pretty Abs.Attribute where
pretty :: forall ann. Attribute -> Doc ann
pretty = \case
Attribute
Abs.Phi -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"φ"
Attribute
Abs.Rho -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"ρ"
Abs.Label LabelId
labelid -> LabelId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. LabelId -> Doc ann
pretty LabelId
labelid
Abs.Alpha AlphaIndex
alphaindex -> AlphaIndex -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. AlphaIndex -> Doc ann
pretty AlphaIndex
alphaindex
Abs.MetaAttr LabelMetaId
labelmetaid -> LabelMetaId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. LabelMetaId -> Doc ann
pretty LabelMetaId
labelmetaid
instance {-# OVERLAPPING #-} Pretty [Abs.LabelId] where
pretty :: forall ann. [LabelId] -> Doc ann
pretty = [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
hsep ([Doc ann] -> Doc ann)
-> ([LabelId] -> [Doc ann]) -> [LabelId] -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc ann -> [Doc ann] -> [Doc ann]
forall ann. Doc ann -> [Doc ann] -> [Doc ann]
punctuate Doc ann
forall ann. Doc ann
comma ([Doc ann] -> [Doc ann])
-> ([LabelId] -> [Doc ann]) -> [LabelId] -> [Doc ann]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LabelId -> Doc ann) -> [LabelId] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap LabelId -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. LabelId -> Doc ann
pretty
instance Pretty Abs.RuleAttribute where
pretty :: forall ann. RuleAttribute -> Doc ann
pretty = \case
Abs.ObjectAttr Attribute
attribute -> Attribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Attribute -> Doc ann
pretty Attribute
attribute
RuleAttribute
Abs.DeltaAttr -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Δ"
RuleAttribute
Abs.LambdaAttr -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"λ"
instance Pretty Abs.PeeledObject where
pretty :: forall ann. PeeledObject -> Doc ann
pretty = \case
Abs.PeeledObject ObjectHead
objecthead [ObjectAction]
objectactions -> ObjectHead -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. ObjectHead -> Doc ann
pretty ObjectHead
objecthead Doc ann -> Doc ann -> Doc ann
forall ann. Doc ann -> Doc ann -> Doc ann
<+> [ObjectAction] -> Doc ann
forall ann. [ObjectAction] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [ObjectAction]
objectactions
instance Pretty Abs.ObjectHead where
pretty :: forall ann. ObjectHead -> Doc ann
pretty = \case
Abs.HeadFormation [Binding]
bindings -> [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep [String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⟦", Int -> Doc ann -> Doc ann
forall ann. Int -> Doc ann -> Doc ann
indent Int
2 ([Binding] -> Doc ann
forall ann. [Binding] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [Binding]
bindings), String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⟧"]
ObjectHead
Abs.HeadGlobal -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"Φ"
ObjectHead
Abs.HeadThis -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"ξ"
ObjectHead
Abs.HeadTermination -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"⊥"
instance Pretty Abs.ObjectAction where
pretty :: forall ann. ObjectAction -> Doc ann
pretty = \case
Abs.ActionApplication [Binding]
bindings -> [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
vsep [Doc ann
forall ann. Doc ann
lparen, Int -> Doc ann -> Doc ann
forall ann. Int -> Doc ann -> Doc ann
indent Int
2 ([Binding] -> Doc ann
forall ann. [Binding] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [Binding]
bindings), Doc ann
forall ann. Doc ann
rparen]
Abs.ActionDispatch Attribute
attribute -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
"." Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Attribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Attribute -> Doc ann
pretty Attribute
attribute
instance {-# OVERLAPPING #-} Pretty [Abs.ObjectAction] where
pretty :: forall ann. [ObjectAction] -> Doc ann
pretty = [Doc ann] -> Doc ann
forall ann. [Doc ann] -> Doc ann
hsep ([Doc ann] -> Doc ann)
-> ([ObjectAction] -> [Doc ann]) -> [ObjectAction] -> Doc ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ObjectAction -> Doc ann) -> [ObjectAction] -> [Doc ann]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ObjectAction -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. ObjectAction -> Doc ann
pretty