From 57edcfbb3231fb53ff121b4418d8cb3aaaa2c4fc Mon Sep 17 00:00:00 2001 From: Sukera Date: Tue, 2 Jul 2024 09:08:14 +0200 Subject: [PATCH] Add missing `show` methods for `Composed` Fixes #44 --- src/api.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/api.jl b/src/api.jl index 736d1fd..b07b651 100644 --- a/src/api.jl +++ b/src/api.jl @@ -382,6 +382,20 @@ struct Composed{S,P,T} <: Data.Possibility{T} end end +function Base.show(io::IO, c::Composed{S}) where S + print(io, "@composed ", S, "(...)") +end + +function Base.show(io::IO, ::MIME"text/plain", c::Composed{S,P,T}) where {S,P,T} + obj = example(c) + print(io, styled""" + {code,underline:$Composed\{$S\}}: + + A {code:$Data.Possibility} generating {code:$T} through {code:$S}. + + E.g. {code:$obj}""") +end + """ @composed