basic-sop-0.1.0.2: Basic examples and functions for generics-sop

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.Show

Description

Generic show.

This module contains a generic show function defined using generics-sop.

Synopsis

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