packages feed

pptable 0.1.0.0 → 0.1.0.1

raw patch · 4 files changed

+11/−9 lines, 4 filesdep ~base

Dependency ranges changed: base

Files

README.md view
@@ -6,7 +6,7 @@  * This module provides simple functions used to print values in tabular format * Version 0.1.0-* Contributes and Bug Reports Welcome+* Contributions and Bug Reports welcome. Please use the Github issue tracker.  ### Examples ### 
pptable.cabal view
@@ -1,5 +1,5 @@ name:                pptable-version:             0.1.0.0+version:             0.1.0.1 synopsis:            Pretty Print containers in a tabular format description:         Please see README.md homepage:            https://github.com/gdevanla/pptable#readme
src/Text/PrettyPrint/Tabilize.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE ConstrainedClassMethods #-}  -- | Module implements the default methods for Tabilize @@ -93,7 +94,7 @@ -- | Specialized class that provides default methods -- methods to print List, Map or Vector values as a -- pretty table-class Tabilize a where+class (Data a) => Tabilize a where   -- | Return a list of values wrapped in a Box. Each entry in input is assumed to be a   -- list of records keyed by any data type. The first entry in the   -- list of values will be used to infer the names of fields@@ -138,7 +139,7 @@   -- > "amzn"     "AMZN"     799.161717      3.7886e11   -- > "goog"     "GOOG"     774.210101      5.3209e11   -- > "yhoo"     "YHOO"     42.2910101         4.0e10-  printMap :: (Show b, Data a) => Map.Map b a -> IO ()+  printMap :: (Show b) => Map.Map b a -> IO ()   printMap m = do     let r = head . Map.elems $ m     let header = constrFields . toConstr $ r@@ -155,7 +156,7 @@   -- > "YHOO"     42.2910101         4.0e10   -- > "GOOG"     774.210101      5.3209e11   -- > "AMZN"     799.161717      3.7886e11-  printList :: (Data a) => [a] -> IO ()+  printList :: [a] -> IO ()   printList m = do     let r = head $ m     let header = constrFields . toConstr $ r@@ -173,7 +174,7 @@   -- > "YHOO"     42.2910101         4.0e10   -- > "GOOG"     774.210101      5.3209e11   -- > "AMZN"     799.161717      3.7886e11-  printVector :: (Data a) => V.Vector a -> IO ()+  printVector :: V.Vector a -> IO ()   printVector m = do     let r = m V.! 0     let header = constrFields . toConstr $ r
test/Spec.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE ConstrainedClassMethods #-}  import Test.Tasty import Data.Map as M@@ -23,11 +24,11 @@                test_double::Double}   deriving (Data, Show, G.Generic) data R01 =  R01 {r1_id::Int, nested_r::R0}-  deriving (Show, G.Generic)+  deriving (Show, G.Generic, Data) data R3 =  R3 {r3_id::Int, nested_rlist::[R0]}-  deriving (Show, G.Generic)+  deriving (Show, G.Generic, Data) data R4 = R4 {r4_id::Int, nested_rtuple::(R0,R0)}-  deriving (Show, G.Generic)+  deriving (Show, G.Generic, Data)  instance Tabilize R0 instance Tabilize R01