MIT licensed by Li-yao Xia
Maintained by [email protected]
This version can be pinned in stack with:show-combinators-0.2.0.0@sha256:5d7a36c6383c9eff1dc15970da3206a05b50c2d1e93155970ffcf240eaa57d58,1277

Module documentation for 0.2.0.0

Depends on 1 package(full list with versions):
Used by 2 packages in lts-21.25(full list with versions):

Show combinators Hackage Build Status

A minimal set of convenient combinators to write Show instances.

data MyType a
  = C a a                   -- a regular constructor
  | a :+: a                 -- an infix constructor
  | R { f1 :: a, f2 :: a }  -- a record

infixl 4 :+:

instance Show a => Show (MyType a) where
  showsPrec = flip precShows where
    precShows (C a b) = showCon "C" @| a @| b
    precShows (c :+: d) = showInfix ":+:" 4 c d
    precShows (R {f1 = e, f2 = f}) =
      showRecord "R" ("f1" .=. e &| "f2" .=. f)

Changes

0.2.0.0

  • Fix a bug where showRecord would not parenthesize the output if a high enough precedence were supplied.

0.1.1.0

  • Added showInfixl, showInfixr, showInfixl', showInfixr'.

0.1.0.0

Initial version