Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generic show.
This module contains a generic show function defined using
generics-sop
.
Documentation
gshow :: forall a. (Generic a, HasDatatypeInfo a, All2 Show (Code a)) => a -> String Source
Generic show.
This function is a proof-of-concept implementation of a function
that is similar to the show
function you get by using
'deriving Show'.
It serves as an example of an SOP-style generic function that makes use of metadata. However, it does currently not handle parentheses correctly, and is therefore not really usable as a replacement.
If you want to use it anyway on a datatype T
for which you have
a Generic
instance, you can use gshow
as follows:
instance Show T where show = gshow