cardano-ledger-binary-1.5.0.0: Binary serialization library used throughout ledger
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Binary.TreeDiff

Synopsis

Documentation

class ToExpr a where Source #

toExpr converts a Haskell value into untyped Haskell-like syntax tree, Expr.

>>> toExpr ((1, Just 2) :: (Int, Maybe Int))
App "_\215_" [App "1" [],App "Just" [App "2" []]]

Minimal complete definition

Nothing

Methods

toExpr ∷ a → Expr Source #

listToExpr ∷ [a] → Expr Source #

Instances

Instances details
ToExpr Key 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprKeyExpr Source #

listToExpr ∷ [Key] → Expr Source #

ToExpr Value 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprValueExpr Source #

listToExpr ∷ [Value] → Expr Source #

ToExpr Void 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprVoidExpr Source #

listToExpr ∷ [Void] → Expr Source #

ToExpr Int16 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprInt16Expr Source #

listToExpr ∷ [Int16] → Expr Source #

ToExpr Int32 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprInt32Expr Source #

listToExpr ∷ [Int32] → Expr Source #

ToExpr Int64 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprInt64Expr Source #

listToExpr ∷ [Int64] → Expr Source #

ToExpr Int8 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprInt8Expr Source #

listToExpr ∷ [Int8] → Expr Source #

ToExpr Word16 
Instance details

Defined in Data.TreeDiff.Class

ToExpr Word32 
Instance details

Defined in Data.TreeDiff.Class

ToExpr Word64 
Instance details

Defined in Data.TreeDiff.Class

ToExpr Word8 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprWord8Expr Source #

listToExpr ∷ [Word8] → Expr Source #

ToExpr ByteString
>>> traverse_ (print . prettyExpr . toExpr . BS8.pack) ["", "\n", "foo", "foo\n", "foo\nbar", "foo\nbar\n"]
""
"\n"
"foo"
"foo\n"
BS.concat ["foo\n", "bar"]
BS.concat ["foo\n", "bar\n"]
Instance details

Defined in Data.TreeDiff.Class

ToExpr ByteString
>>> traverse_ (print . prettyExpr . toExpr . LBS8.pack) ["", "\n", "foo", "foo\n", "foo\nbar", "foo\nbar\n"]
""
"\n"
"foo"
"foo\n"
LBS.concat ["foo\n", "bar"]
LBS.concat ["foo\n", "bar\n"]
Instance details

Defined in Data.TreeDiff.Class

ToExpr ShortByteString
>>> traverse_ (print . prettyExpr . toExpr . SBS.toShort . BS8.pack) ["", "\n", "foo", "foo\n", "foo\nbar", "foo\nbar\n"]
""
"\n"
"foo"
"foo\n"
mconcat ["foo\n", "bar"]
mconcat ["foo\n", "bar\n"]
Instance details

Defined in Data.TreeDiff.Class

ToExpr Version Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr CBORBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr HexBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr Term Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Methods

toExprTermExpr Source #

listToExpr ∷ [Term] → Expr Source #

ToExpr IntSet 
Instance details

Defined in Data.TreeDiff.Class

ToExpr ByteArray

Since: tree-diff-0.2.2

Instance details

Defined in Data.TreeDiff.Class

ToExpr Ordering 
Instance details

Defined in Data.TreeDiff.Class

ToExpr IPv4 Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Methods

toExprIPv4Expr Source #

listToExpr ∷ [IPv4] → Expr Source #

ToExpr IPv6 Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Methods

toExprIPv6Expr Source #

listToExpr ∷ [IPv6] → Expr Source #

ToExpr Scientific
>>> prettyExpr $ toExpr (123.456 :: Scientific)
scientific 123456 `-3`
Instance details

Defined in Data.TreeDiff.Class

ToExpr Text
>>> traverse_ (print . prettyExpr . toExpr . T.pack) ["", "\n", "foo", "foo\n", "foo\nbar", "foo\nbar\n"]
""
"\n"
"foo"
"foo\n"
T.concat ["foo\n", "bar"]
T.concat ["foo\n", "bar\n"]
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprTextExpr Source #

listToExpr ∷ [Text] → Expr Source #

ToExpr Text
>>> traverse_ (print . prettyExpr . toExpr . LT.pack) ["", "\n", "foo", "foo\n", "foo\nbar", "foo\nbar\n"]
""
"\n"
"foo"
"foo\n"
LT.concat ["foo\n", "bar"]
LT.concat ["foo\n", "bar\n"]
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprTextExpr Source #

listToExpr ∷ [Text] → Expr Source #

ToExpr Day
>>> prettyExpr $ toExpr $ ModifiedJulianDay 58014
Day "2017-09-18"
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprDayExpr Source #

listToExpr ∷ [Day] → Expr Source #

ToExpr UTCTime 
Instance details

Defined in Data.TreeDiff.Class

ToExpr Expr 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprExprExpr Source #

listToExpr ∷ [Expr] → Expr Source #

ToExpr UUID
>>> prettyExpr $ toExpr UUID.nil
UUID "00000000-0000-0000-0000-000000000000"
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprUUIDExpr Source #

listToExpr ∷ [UUID] → Expr Source #

ToExpr Integer 
Instance details

Defined in Data.TreeDiff.Class

ToExpr Natural 
Instance details

Defined in Data.TreeDiff.Class

ToExpr () 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExpr ∷ () → Expr Source #

listToExpr ∷ [()] → Expr Source #

ToExpr Bool 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprBoolExpr Source #

listToExpr ∷ [Bool] → Expr Source #

ToExpr Char
>>> prettyExpr $ toExpr 'a'
'a'
>>> prettyExpr $ toExpr "Hello world"
"Hello world"
>>> prettyExpr $ toExpr "Hello\nworld"
concat ["Hello\n", "world"]
>>> traverse_ (print . prettyExpr . toExpr) ["", "\n", "foo", "foo\n", "foo\nbar", "foo\nbar\n"]
""
"\n"
"foo"
"foo\n"
concat ["foo\n", "bar"]
concat ["foo\n", "bar\n"]
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprCharExpr Source #

listToExpr ∷ [Char] → Expr Source #

ToExpr Double 
Instance details

Defined in Data.TreeDiff.Class

ToExpr Float 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprFloatExpr Source #

listToExpr ∷ [Float] → Expr Source #

ToExpr Int 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprIntExpr Source #

listToExpr ∷ [Int] → Expr Source #

ToExpr Word 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprWordExpr Source #

listToExpr ∷ [Word] → Expr Source #

ToExpr a ⇒ ToExpr (KeyMap a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprKeyMap a → Expr Source #

listToExpr ∷ [KeyMap a] → Expr Source #

ToExpr a ⇒ ToExpr (ZipList a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprZipList a → Expr Source #

listToExpr ∷ [ZipList a] → Expr Source #

ToExpr a ⇒ ToExpr (Identity a)
>>> prettyExpr $ toExpr $ Identity 'a'
Identity 'a'
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprIdentity a → Expr Source #

listToExpr ∷ [Identity a] → Expr Source #

ToExpr a ⇒ ToExpr (First a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprFirst a → Expr Source #

listToExpr ∷ [First a] → Expr Source #

ToExpr a ⇒ ToExpr (Last a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprLast a → Expr Source #

listToExpr ∷ [Last a] → Expr Source #

ToExpr a ⇒ ToExpr (First a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprFirst a → Expr Source #

listToExpr ∷ [First a] → Expr Source #

ToExpr a ⇒ ToExpr (Last a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprLast a → Expr Source #

listToExpr ∷ [Last a] → Expr Source #

ToExpr a ⇒ ToExpr (Max a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprMax a → Expr Source #

listToExpr ∷ [Max a] → Expr Source #

ToExpr a ⇒ ToExpr (Min a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprMin a → Expr Source #

listToExpr ∷ [Min a] → Expr Source #

ToExpr a ⇒ ToExpr (Dual a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprDual a → Expr Source #

listToExpr ∷ [Dual a] → Expr Source #

ToExpr a ⇒ ToExpr (Product a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprProduct a → Expr Source #

listToExpr ∷ [Product a] → Expr Source #

ToExpr a ⇒ ToExpr (Sum a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprSum a → Expr Source #

listToExpr ∷ [Sum a] → Expr Source #

(ToExpr a, Integral a) ⇒ ToExpr (Ratio a)
>>> prettyExpr $ toExpr (3 % 12 :: Rational)
_%_ 1 4
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprRatio a → Expr Source #

listToExpr ∷ [Ratio a] → Expr Source #

ToExpr a ⇒ ToExpr (Sized a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Methods

toExprSized a → Expr Source #

listToExpr ∷ [Sized a] → Expr Source #

ToExpr a ⇒ ToExpr (StrictMaybe a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr a ⇒ ToExpr (StrictSeq a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr v ⇒ ToExpr (IntMap v) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprIntMap v → Expr Source #

listToExpr ∷ [IntMap v] → Expr Source #

ToExpr v ⇒ ToExpr (Seq v) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprSeq v → Expr Source #

listToExpr ∷ [Seq v] → Expr Source #

ToExpr k ⇒ ToExpr (Set k) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprSet k → Expr Source #

listToExpr ∷ [Set k] → Expr Source #

ToExpr a ⇒ ToExpr (Tree a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprTree a → Expr Source #

listToExpr ∷ [Tree a] → Expr Source #

ToExpr a ⇒ ToExpr (Hashed a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprHashed a → Expr Source #

listToExpr ∷ [Hashed a] → Expr Source #

ToExpr a ⇒ ToExpr (Maybe a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprMaybe a → Expr Source #

listToExpr ∷ [Maybe a] → Expr Source #

ToExpr k ⇒ ToExpr (HashSet k) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprHashSet k → Expr Source #

listToExpr ∷ [HashSet k] → Expr Source #

ToExpr a ⇒ ToExpr (Vector a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprVector a → Expr Source #

listToExpr ∷ [Vector a] → Expr Source #

(ToExpr a, Prim a) ⇒ ToExpr (Vector a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprVector a → Expr Source #

listToExpr ∷ [Vector a] → Expr Source #

(ToExpr a, Storable a) ⇒ ToExpr (Vector a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprVector a → Expr Source #

listToExpr ∷ [Vector a] → Expr Source #

(ToExpr a, Unbox a) ⇒ ToExpr (Vector a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprVector a → Expr Source #

listToExpr ∷ [Vector a] → Expr Source #

ToExpr a ⇒ ToExpr (NonEmpty a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprNonEmpty a → Expr Source #

listToExpr ∷ [NonEmpty a] → Expr Source #

ToExpr a ⇒ ToExpr (Maybe a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprMaybe a → Expr Source #

listToExpr ∷ [Maybe a] → Expr Source #

ToExpr a ⇒ ToExpr [a] 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExpr ∷ [a] → Expr Source #

listToExpr ∷ [[a]] → Expr Source #

(ToExpr a, ToExpr b) ⇒ ToExpr (Either a b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprEither a b → Expr Source #

listToExpr ∷ [Either a b] → Expr Source #

HasResolution a ⇒ ToExpr (Fixed a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprFixed a → Expr Source #

listToExpr ∷ [Fixed a] → Expr Source #

ToExpr (Proxy a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprProxy a → Expr Source #

listToExpr ∷ [Proxy a] → Expr Source #

DSIGNAlgorithm c ⇒ ToExpr (SignedDSIGN c index) Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Methods

toExprSignedDSIGN c index → Expr Source #

listToExpr ∷ [SignedDSIGN c index] → Expr Source #

ToExpr (Hash c index) Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Methods

toExprHash c index → Expr Source #

listToExpr ∷ [Hash c index] → Expr Source #

(ToExpr k, ToExpr v) ⇒ ToExpr (Map k v) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprMap k v → Expr Source #

listToExpr ∷ [Map k v] → Expr Source #

(ToExpr a, ToExpr b) ⇒ ToExpr (Either a b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprEither a b → Expr Source #

listToExpr ∷ [Either a b] → Expr Source #

(ToExpr a, ToExpr b) ⇒ ToExpr (These a b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprThese a b → Expr Source #

listToExpr ∷ [These a b] → Expr Source #

(ToExpr a, ToExpr b) ⇒ ToExpr (Pair a b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprPair a b → Expr Source #

listToExpr ∷ [Pair a b] → Expr Source #

(ToExpr a, ToExpr b) ⇒ ToExpr (These a b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprThese a b → Expr Source #

listToExpr ∷ [These a b] → Expr Source #

(ToExpr k, ToExpr v) ⇒ ToExpr (HashMap k v) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprHashMap k v → Expr Source #

listToExpr ∷ [HashMap k v] → Expr Source #

(ToExpr a, ToExpr b) ⇒ ToExpr (a, b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExpr ∷ (a, b) → Expr Source #

listToExpr ∷ [(a, b)] → Expr Source #

ToExpr a ⇒ ToExpr (Const a b) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprConst a b → Expr Source #

listToExpr ∷ [Const a b] → Expr Source #

ToExpr a ⇒ ToExpr (Tagged t a) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprTagged t a → Expr Source #

listToExpr ∷ [Tagged t a] → Expr Source #

(ToExpr a, ToExpr b, ToExpr c) ⇒ ToExpr (a, b, c) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExpr ∷ (a, b, c) → Expr Source #

listToExpr ∷ [(a, b, c)] → Expr Source #

(ToExpr a, ToExpr b, ToExpr c, ToExpr d) ⇒ ToExpr (a, b, c, d) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExpr ∷ (a, b, c, d) → Expr Source #

listToExpr ∷ [(a, b, c, d)] → Expr Source #

(ToExpr a, ToExpr b, ToExpr c, ToExpr d, ToExpr e) ⇒ ToExpr (a, b, c, d, e) 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExpr ∷ (a, b, c, d, e) → Expr Source #

listToExpr ∷ [(a, b, c, d, e)] → Expr Source #

newtype CBORBytes Source #

Constructors

CBORBytes 

Instances

Instances details
Show CBORBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Eq CBORBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr CBORBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

newtype HexBytes Source #

Wraps regular ByteString, but shows and diffs it as hex

Constructors

HexBytes 

Instances

Instances details
Show HexBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

Eq HexBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

ToExpr HexBytes Source # 
Instance details

Defined in Test.Cardano.Ledger.Binary.TreeDiff

showExprToExpr a ⇒ a → String Source #

diffExprToExpr a ⇒ a → a → Doc AnsiStyle Source #

diffExprStringToExpr a ⇒ a → a → String Source #

diffExprCompactToExpr a ⇒ a → a → Doc AnsiStyle Source #

showHexBytesGroupedIntByteString → [String] Source #

Show a ByteString as hex groups of 8bytes each. This is a slightly more useful form for debugging, rather than bunch of escaped characters.

assertColorFailureHasCallStackStringIO a Source #

Similar to assertFailure, except hspec will not interfer with any escape sequences that indicate color output.

expectExprEqual ∷ (Eq a, ToExpr a) ⇒ a → a → Expectation Source #

Check that two values are equal and if they are not raise an exception with the ToExpr diff

expectExprEqualWithMessage ∷ (ToExpr a, Eq a, HasCallStack) ⇒ String → a → a → Expectation Source #

Use this with HSpec, but with Tasty use assertExprEqualWithMessage below

assertExprEqualWithMessage ∷ (ToExpr a, Eq a, HasCallStack) ⇒ String → a → a → Assertion Source #

Use this with Tasty, but with HSpec use expectExprEqualWithMessage above

callStackToLocationCallStackMaybe Location Source #

Convert the top call from the CallStack to hspec's Location

data Expr Source #

A untyped Haskell-like expression.

Having richer structure than just Tree allows to have richer diffs.

Constructors

App ConstructorName [Expr]

application

Rec ConstructorName (OMap FieldName Expr)

record constructor

Lst [Expr]

list constructor

Instances

Instances details
Arbitrary Expr 
Instance details

Defined in Data.TreeDiff.Expr

Show Expr 
Instance details

Defined in Data.TreeDiff.Expr

Methods

showsPrecIntExprShowS Source #

showExprString Source #

showList ∷ [Expr] → ShowS Source #

NFData Expr 
Instance details

Defined in Data.TreeDiff.Expr

Methods

rnfExpr → () Source #

Eq Expr 
Instance details

Defined in Data.TreeDiff.Expr

Methods

(==)ExprExprBool Source #

(/=)ExprExprBool Source #

Ord Expr 
Instance details

Defined in Data.TreeDiff.Expr

Methods

compareExprExprOrdering Source #

(<)ExprExprBool Source #

(<=)ExprExprBool Source #

(>)ExprExprBool Source #

(>=)ExprExprBool Source #

maxExprExprExpr Source #

minExprExprExpr Source #

ToExpr Expr 
Instance details

Defined in Data.TreeDiff.Class

Methods

toExprExprExpr Source #

listToExpr ∷ [Expr] → Expr Source #

defaultExprViaShowShow a ⇒ a → Expr Source #

An alternative implementation for literal types. We use show representation of them.

trimExprViaShowShow a ⇒ Int → a → Expr Source #

data Pretty doc Source #

Because we don't want to commit to single pretty printing library, we use explicit dictionary.

Constructors

Pretty 

Fields

data Doc ann Source #

The abstract data type Doc ann represents pretty documents that have been annotated with data of type ann.

More specifically, a value of type Doc represents a non-empty set of possible layouts of a document. The layout functions select one of these possibilities, taking into account things like the width of the output document.

The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as

  • color information (e.g. when rendering to the terminal)
  • mouseover text (e.g. when rendering to rich HTML)
  • whether to show something or not (to allow simple or detailed versions)

The simplest way to display a Doc is via the Show class.

>>> putStrLn (show (vsep ["hello", "world"]))
hello
world

Instances

Instances details
Functor Doc

Alter the document’s annotations.

This instance makes Doc more flexible (because it can be used in Functor-polymorphic values), but fmap is much less readable compared to using reAnnotate in code that only works for Doc anyway. Consider using the latter when the type does not matter.

Instance details

Defined in Prettyprinter.Internal

Methods

fmap ∷ (a → b) → Doc a → Doc b Source #

(<$) ∷ a → Doc b → Doc a Source #

IsString (Doc ann)
>>> pretty ("hello\nworld")
hello
world

This instance uses the Pretty Doc instance, and uses the same newline to line conversion.

Instance details

Defined in Prettyprinter.Internal

Methods

fromStringStringDoc ann Source #

Monoid (Doc ann)
mempty = emptyDoc
mconcat = hcat
>>> mappend "hello" "world" :: Doc ann
helloworld
Instance details

Defined in Prettyprinter.Internal

Methods

memptyDoc ann Source #

mappendDoc ann → Doc ann → Doc ann Source #

mconcat ∷ [Doc ann] → Doc ann Source #

Semigroup (Doc ann)
x <> y = hcat [x, y]
>>> "hello" <> "world" :: Doc ann
helloworld
Instance details

Defined in Prettyprinter.Internal

Methods

(<>)Doc ann → Doc ann → Doc ann Source #

sconcatNonEmpty (Doc ann) → Doc ann Source #

stimesIntegral b ⇒ b → Doc ann → Doc ann Source #

Generic (Doc ann) 
Instance details

Defined in Prettyprinter.Internal

Associated Types

type Rep (Doc ann) ∷ TypeType Source #

Methods

fromDoc ann → Rep (Doc ann) x Source #

toRep (Doc ann) x → Doc ann Source #

Show (Doc ann)

(show doc) prettyprints document doc with defaultLayoutOptions, ignoring all annotations.

Instance details

Defined in Prettyprinter.Internal

Methods

showsPrecIntDoc ann → ShowS Source #

showDoc ann → String Source #

showList ∷ [Doc ann] → ShowS Source #

type Rep (Doc ann) 
Instance details

Defined in Prettyprinter.Internal

type Rep (Doc ann) = D1 ('MetaData "Doc" "Prettyprinter.Internal" "prettyprinter-1.7.1-60fc2444dcacdd48cc73f93e5ef87c40fa69faa308b0e641b05323137692b85e" 'False) (((C1 ('MetaCons "Fail" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "Empty" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Char" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Char)))) :+: (C1 ('MetaCons "Text" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "Line" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "FlatAlt" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)))))) :+: ((C1 ('MetaCons "Cat" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))) :+: (C1 ('MetaCons "Nest" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))) :+: C1 ('MetaCons "Union" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann))))) :+: ((C1 ('MetaCons "Column" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IntDoc ann))) :+: C1 ('MetaCons "WithPageWidth" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PageWidthDoc ann)))) :+: (C1 ('MetaCons "Nesting" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (IntDoc ann))) :+: C1 ('MetaCons "Annotated" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ann)))))))

data AnsiStyle Source #

Render the annotated document in a certain style. Styles not set in the annotation will use the style of the surrounding document, or the terminal’s default if none has been set yet.

style = color Green <> bold
styledDoc = annotate style "hello world"

Instances

Instances details
Monoid AnsiStyle

mempty does nothing, which is equivalent to inheriting the style of the surrounding doc, or the terminal’s default if no style has been set yet.

Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Semigroup AnsiStyle

Keep the first decision for each of foreground color, background color, boldness, italication, and underlining. If a certain style is not set, the terminal’s default will be used.

Example:

color Red <> color Green

is red because the first color wins, and not bold because (or if) that’s the terminal’s default.

Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Show AnsiStyle 
Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Eq AnsiStyle 
Instance details

Defined in Prettyprinter.Render.Terminal.Internal

Ord AnsiStyle 
Instance details

Defined in Prettyprinter.Render.Terminal.Internal

ansiWlPrettyPretty Doc Source #

Pretty via ansi-wl-pprint library (with colors).

ppEditExprPretty doc → Edit EditExpr → doc Source #

Pretty print an Edit EditExpr using explicit pretty-printing dictionary.

ediffToExpr a ⇒ a → a → Edit EditExpr Source #

Difference between two ToExpr values.

>>> let x = (1, Just 2) :: (Int, Maybe Int)
>>> let y = (1, Nothing)
>>> prettyEditExpr (ediff x y)
_×_ 1 -(Just 2) +Nothing
>>> data Foo = Foo { fooInt :: Either Char Int, fooBool :: [Maybe Bool], fooString :: String } deriving (Eq, Generic)
>>> instance ToExpr Foo
>>> prettyEditExpr $ ediff (Foo (Right 2) [Just True] "fo") (Foo (Right 3) [Just True] "fo")
Foo {fooInt = Right -2 +3, fooBool = [Just True], fooString = "fo"}
>>> prettyEditExpr $ ediff (Foo (Right 42) [Just True, Just False] "old") (Foo (Right 42) [Nothing, Just False, Just True] "new")
Foo {
  fooInt = Right 42,
  fooBool = [-Just True, +Nothing, Just False, +Just True],
  fooString = -"old" +"new"}

Orphan instances

ToExpr Version Source # 
Instance details

ToExpr Term Source # 
Instance details

Methods

toExprTermExpr Source #

listToExpr ∷ [Term] → Expr Source #

ToExpr IPv4 Source # 
Instance details

Methods

toExprIPv4Expr Source #

listToExpr ∷ [IPv4] → Expr Source #

ToExpr IPv6 Source # 
Instance details

Methods

toExprIPv6Expr Source #

listToExpr ∷ [IPv6] → Expr Source #

ToExpr a ⇒ ToExpr (Sized a) Source # 
Instance details

Methods

toExprSized a → Expr Source #

listToExpr ∷ [Sized a] → Expr Source #

ToExpr a ⇒ ToExpr (StrictMaybe a) Source # 
Instance details

ToExpr a ⇒ ToExpr (StrictSeq a) Source # 
Instance details

DSIGNAlgorithm c ⇒ ToExpr (SignedDSIGN c index) Source # 
Instance details

Methods

toExprSignedDSIGN c index → Expr Source #

listToExpr ∷ [SignedDSIGN c index] → Expr Source #

ToExpr (Hash c index) Source # 
Instance details

Methods

toExprHash c index → Expr Source #

listToExpr ∷ [Hash c index] → Expr Source #