pretty-sop-0.2.0.3: 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.

Minimal complete definition

Nothing

Methods

prettyVal :: a -> Value #

Instances
PrettyVal Bool 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Bool -> Value #

listValue :: [Bool] -> Value

PrettyVal Char 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Char -> Value #

listValue :: [Char] -> Value

PrettyVal Double 
Instance details

Defined in Text.Show.PrettyVal

PrettyVal Float 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Float -> Value #

listValue :: [Float] -> Value

PrettyVal Int 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Int -> Value #

listValue :: [Int] -> Value

PrettyVal Int8 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Int8 -> Value #

listValue :: [Int8] -> Value

PrettyVal Int16 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Int16 -> Value #

listValue :: [Int16] -> Value

PrettyVal Int32 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Int32 -> Value #

listValue :: [Int32] -> Value

PrettyVal Int64 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Int64 -> Value #

listValue :: [Int64] -> Value

PrettyVal Integer 
Instance details

Defined in Text.Show.PrettyVal

PrettyVal Ordering 
Instance details

Defined in Text.Show.PrettyVal

PrettyVal Word8 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Word8 -> Value #

listValue :: [Word8] -> Value

PrettyVal Word16 
Instance details

Defined in Text.Show.PrettyVal

PrettyVal Word32 
Instance details

Defined in Text.Show.PrettyVal

PrettyVal Word64 
Instance details

Defined in Text.Show.PrettyVal

PrettyVal Text 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Text -> Value #

listValue :: [Text] -> Value

PrettyVal a => PrettyVal [a] 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: [a] -> Value #

listValue :: [[a]] -> Value

PrettyVal a => PrettyVal (Maybe a) 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Maybe a -> Value #

listValue :: [Maybe a] -> Value

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

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Ratio a -> Value #

listValue :: [Ratio a] -> Value

HasResolution p => PrettyVal (Fixed p) 
Instance details

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Fixed p -> Value #

listValue :: [Fixed p] -> Value

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

Defined in Text.Show.PrettyVal

Methods

prettyVal :: Either a b -> Value #

listValue :: [Either a b] -> Value

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

Defined in Text.Show.PrettyVal

Methods

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

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

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

Defined in Text.Show.PrettyVal

Methods

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

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

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

Defined in Text.Show.PrettyVal

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) 
Instance details

Defined in Text.Show.PrettyVal

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) 
Instance details

Defined in Text.Show.PrettyVal

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) 
Instance details

Defined in Text.Show.PrettyVal

Methods

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

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