packages feed

pretty-display 0.1.8 → 0.1.9

raw patch · 3 files changed

+53/−11 lines, 3 files

Files

example/Basic.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Main where  import Numeric@@ -16,7 +17,11 @@   , denominator = 1326   } -instance {-# OVERLAPPING #-} Display MyRecord where+instance+#if __GLASGOW_HASKELL >= 710+  {-# OVERLAPPING #-}+#endif+  Display MyRecord where   display a = mkDisplayTextStr       $ show       $ toCol "MyRecord (percentage): " <> toCol (displayPerc a)
pretty-display.cabal view
@@ -1,8 +1,24 @@ name:                pretty-display-version:             0.1.8+version:             0.1.9 synopsis:            Typeclass for human-readable display-description:         Typeclass for human-readable display. Provides tools for-                     working interactively within ghci.+description:         <<https://travis-ci.org/jsermeno/pretty-display.svg?branch=master>>+                     <<https://img.shields.io/badge/language-Haskell-blue.svg>>+                     <<http://img.shields.io/badge/license-BSD3-brightgreen.svg>>+                     .+                     In haskell the @Show@ typeclass is used to display a+                     syntactically correct Haskell expression. However, there+                     are times when you want to provide a richer display for a+                     value while still retaining the benefits of having+                     derived @Show@ instances. This can be especially useful+                     when working interactively in ghci. @Text.Display@+                     provides a tiny registered package with the @Display@+                     typeclass just for this purpose.+                     .+                     <<https://cloud.githubusercontent.com/assets/197051/20434593/74a2b66c-ad76-11e6-9eef-cff6352d08b1.png>>+                     .+                     For examples visit the+                     <https://github.com/githubuser/pretty-display#readme README>+ homepage:            https://github.com/githubuser/pretty-display#readme license:             BSD3 license-file:        LICENSE@@ -12,7 +28,7 @@ category:            Text build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC==8.0.1, GHC==7.10.3, GHC==7.10.2+tested-with:         GHC==8.0.1, GHC==7.10.3, GHC==7.10.2, GHC==7.8.4  library   hs-source-dirs:      src
src/Text/Display.hs view
@@ -4,8 +4,26 @@ #if __GLASGOW_HASKELL__ < 710 {-# LANGUAGE OverlappingInstances #-} #endif+--------------------------------------------------------------------------------+-- |+-- Module     : Text.Display+-- Copyright  : (C) 2016 Justin Sermeno+-- License    : BSD3+-- Maintainer : Justin Sermeno+--+-- An instance @Display@ is similar to an instance of @Show@. The difference is that -- @Show@ is meant to return well-formed haskell expressions and a complementary+-- @Read@ instance should be possible. @Display@ is meant for human-readable output.+-- For instance, you could have a complex data structure output a chart by default+-- in GHCi, while still being able to derive an instance of @Show@ to inspect the+-- data structure when needed.+-------------------------------------------------------------------------------- module Text.Display-  ( mkDisplayText+  ( -- * Types+    Display(..)+  , DisplayText++  -- * Converting to the 'DisplayText' type+  , mkDisplayText   , unDisplayText   , mkDt   , unDt@@ -13,15 +31,14 @@   , unDisplayTextStr   , mkDtStr   , unDtStr++  -- * Rendering the 'Display' class+  , dShow   , dPrint    -- * Re-exports   , Pretty.ppShow   , pPrint--  -- * Types-  , Display(..)-  , DisplayText   )   where @@ -39,7 +56,11 @@ class Display a where   display :: a -> DisplayText -instance {-# Overlappable #-} (Show a) => Display a where+instance+#if __GLASGOW_HASKELL__ >= 710+  {-# Overlappable #-}+#endif+  (Show a) => Display a where   display a = (DisplayText . Text.pack . Pretty.ppShow) a  -- | Wrap 'Text' into a 'DisplayText'.