pretty-sop-0.2.0.1: A generic pretty-printer using generics-sop

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.PrettyVal

Contents

Description

Generic pretty-printer.

This module defines a generic function that helps in defining class instances for the PrettyVal class from the pretty-show package.

Synopsis

Documentation

gprettyVal :: forall a. (Generic a, HasDatatypeInfo a, All2 PrettyVal (Code a)) => a -> Value Source #

Generic pretty-printer.

This function turns a value into the uniform representation of type Value that is provided by the pretty-show package. The function has the suitable type to serve as the default implementation of the prettyVal function in the PrettyVal class.

If you have a datatype T that is an instance of generic-sop's Generic and HasDatatypeInfo classes, you can use gprettyVal as follows:

instance PrettyVal T where
  prettyVal = gprettyVal

Re-exports

class PrettyVal a where #

A class for types that may be reified into a value. Instances of this class may be derived automatically, for datatypes that support Generics.

Methods

prettyVal :: a -> Value #

Instances

PrettyVal Bool 

Methods

prettyVal :: Bool -> Value #

listValue :: [Bool] -> Value

PrettyVal Char 

Methods

prettyVal :: Char -> Value #

listValue :: [Char] -> Value

PrettyVal Double 
PrettyVal Float 

Methods

prettyVal :: Float -> Value #

listValue :: [Float] -> Value

PrettyVal Int 

Methods

prettyVal :: Int -> Value #

listValue :: [Int] -> Value

PrettyVal Int8 

Methods

prettyVal :: Int8 -> Value #

listValue :: [Int8] -> Value

PrettyVal Int16 

Methods

prettyVal :: Int16 -> Value #

listValue :: [Int16] -> Value

PrettyVal Int32 

Methods

prettyVal :: Int32 -> Value #

listValue :: [Int32] -> Value

PrettyVal Int64 

Methods

prettyVal :: Int64 -> Value #

listValue :: [Int64] -> Value

PrettyVal Integer 
PrettyVal Ordering 
PrettyVal Word8 

Methods

prettyVal :: Word8 -> Value #

listValue :: [Word8] -> Value

PrettyVal Word16 
PrettyVal Word32 
PrettyVal Word64 
PrettyVal a => PrettyVal [a] 

Methods

prettyVal :: [a] -> Value #

listValue :: [[a]] -> Value

PrettyVal a => PrettyVal (Maybe a) 

Methods

prettyVal :: Maybe a -> Value #

listValue :: [Maybe a] -> Value

(PrettyVal a, Integral a) => PrettyVal (Ratio a) 

Methods

prettyVal :: Ratio a -> Value #

listValue :: [Ratio a] -> Value

(PrettyVal a, PrettyVal b) => PrettyVal (Either a b) 

Methods

prettyVal :: Either a b -> Value #

listValue :: [Either a b] -> Value

(PrettyVal a1, PrettyVal a2) => PrettyVal (a1, a2) 

Methods

prettyVal :: (a1, a2) -> Value #

listValue :: [(a1, a2)] -> Value

(PrettyVal a1, PrettyVal a2, PrettyVal a3) => PrettyVal (a1, a2, a3) 

Methods

prettyVal :: (a1, a2, a3) -> Value #

listValue :: [(a1, a2, a3)] -> Value

(PrettyVal a1, PrettyVal a2, PrettyVal a3, PrettyVal a4) => PrettyVal (a1, a2, a3, a4) 

Methods

prettyVal :: (a1, a2, a3, a4) -> Value #

listValue :: [(a1, a2, a3, a4)] -> Value

(PrettyVal a1, PrettyVal a2, PrettyVal a3, PrettyVal a4, PrettyVal a5) => PrettyVal (a1, a2, a3, a4, a5) 

Methods

prettyVal :: (a1, a2, a3, a4, a5) -> Value #

listValue :: [(a1, a2, a3, a4, a5)] -> Value

(PrettyVal a1, PrettyVal a2, PrettyVal a3, PrettyVal a4, PrettyVal a5, PrettyVal a6) => PrettyVal (a1, a2, a3, a4, a5, a6) 

Methods

prettyVal :: (a1, a2, a3, a4, a5, a6) -> Value #

listValue :: [(a1, a2, a3, a4, a5, a6)] -> Value

(PrettyVal a1, PrettyVal a2, PrettyVal a3, PrettyVal a4, PrettyVal a5, PrettyVal a6, PrettyVal a7) => PrettyVal (a1, a2, a3, a4, a5, a6, a7) 

Methods

prettyVal :: (a1, a2, a3, a4, a5, a6, a7) -> Value #

listValue :: [(a1, a2, a3, a4, a5, a6, a7)] -> Value