First error
Problem 1: Since your pattern synonym uses <-
and not =
, and it doesn't have a where
, it's unidirectional, so you can only match on it, not use it as a value. You can make it explicitly bidirectional by doing something like this:
pattern IsTrue :: (Read a, Show a) => a
pattern IsTrue <- ((== "True") . show -> True)
where IsTrue = read "True"
Although for that particular pattern, that's really contrived and probably never actually useful.
Problem 2: Functions don't have Show
instances, and in IsTrue "True"
, you're trying to use IsTrue
as a function even though it requires a Show
instance.
Second error
Your code only ensures that the b
in MkT
has a Show
instance, but you're trying to show
the whole T
, which does not have a Show
instance. Either pattern-match the b
back out of it and just show
that, or add a Show
instance to t
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…