Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Util.PrettyGeneric

Contents

Description

Functions to convert a G.Generic data type to a Value and pretty print a Value.

TODO Value could also be used for a generic diff.

Synopsis

Documentation

data Value Source #

Constructors

Prim !String 
Data !Constructor 
Instances
Show Value # 
Instance details

Defined in Util.PrettyGeneric

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

data Constructor Source #

Constructor name [field].

Constructors

Constructor !String ![Field] 
Instances
Show Constructor # 
Instance details

Defined in Util.PrettyGeneric

data Field Source #

Field name value. The name is "" for unnamed fields.

Constructors

Field 

Fields

Instances
Show Field # 
Instance details

Defined in Util.PrettyGeneric

Methods

showsPrec :: Int -> Field -> ShowS #

show :: Field -> String #

showList :: [Field] -> ShowS #

functions on Value

makePretty Source #

Arguments

:: (Text -> Text)

applied to field labels, to strip prefixes

-> Value 
-> Doc 

Make a Pretty instance for a record type.

class Extract a where Source #

Methods

extract :: a -> Value Source #

extract :: (G.Generic a, ExtractData (G.Rep a)) => a -> Value Source #

Instances
Extract Bool # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: Bool -> Value Source #

Extract Char # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: Char -> Value Source #

Extract Int # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: Int -> Value Source #

Extract () # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: () -> Value Source #

Extract String # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: String -> Value Source #

Extract ByteString.ByteString # 
Instance details

Defined in Util.PrettyGeneric

Extract Text # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: Text -> Value Source #

(Extract k, Extract v) => Extract (Map k v) # 
Instance details

Defined in Util.PrettyGeneric

Methods

extract :: Map k v -> Value Source #