pretty-show 1.7 → 1.8
raw patch · 6 files changed
+70/−470 lines, 6 filessetup-changed
Files
- CHANGELOG +5/−0
- Setup.hs +6/−0
- Setup.lhs +0/−8
- Text/Show/Parser.y +28/−4
- dist/build/Text/Show/Parser.hs +30/−457
- pretty-show.cabal +1/−1
CHANGELOG view
@@ -1,3 +1,8 @@+Changes in 1.8+ * Rejigger the rendering of unusal values, to improve the rendering of datres.+ - a sequence of values with negative numbers is turned into an infix con+ - change the association when sequences meet infix things+ Changes in 1.7 * Add a dependency on package Text - Adds an instance for `PrettyVal Text`
+ Setup.hs view
@@ -0,0 +1,6 @@+module Main (main) where++import Distribution.Simple (defaultMain)++main :: IO ()+main = defaultMain
− Setup.lhs
@@ -1,8 +0,0 @@-#! /usr/bin/env runhaskell--> module Main (main) where->-> import Distribution.Simple (defaultMain)->-> main :: IO ()-> main = defaultMain
Text/Show/Parser.y view
@@ -49,7 +49,7 @@ value :: { Value } : value '%' app_value { Ratio $1 $3 } | app_value { $1 }- | app_value list1(infixelem) { InfixCons $1 $2 }+ | app_value list1(infixelem) { mkInfixCons $1 $2 } infixelem :: { (String,Value) } : infixcon app_value { ($1,$2) }@@ -124,7 +124,31 @@ happyError [] = Nothing -- error ("Parser error at EOF") mkValue :: [Value] -> Value-mkValue [v] = v-mkValue (Con x [] : vs) = Con x vs-mkValue vs = Con "" vs+mkValue [v] = v+mkValue (Con "" [] : vs) = mkValue vs+mkValue (Con x [] : vs) = Con x vs+mkValue (InfixCons v xs : Neg x : more)+ = mkValue (mkInfixCons v (xs ++ [("-",x)]) : more)+mkValue (v : Neg x : more) = mkValue (mkInfixCons v [("-",x)] : more)+mkValue vs = Con "" vs++{- When we see a sequence of thins:+1 2 3 + x + y+we parse it as:+1 2 (3 + x + y)++we do this to make parsing of dates to look a little nicer:++(2018-08-05) 09 : 31++ends up as++(2018-08-05) (09:31)+-}++mkInfixCons :: Value -> [(Name,Value)] -> Value+mkInfixCons (Con "" as) bs | not (null as) =+ Con "" (init as ++ [InfixCons (last as) bs])+mkInfixCons a bs = InfixCons a bs+ }
dist/build/Text/Show/Parser.hs view
@@ -15,7 +15,7 @@ import Control.Applicative(Applicative(..)) import Control.Monad (ap) --- parser produced by Happy Version 1.19.8+-- parser produced by Happy Version 1.19.9 newtype HappyAbsSyn t12 t13 t14 t15 t16 t17 t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 t28 t29 t30 t31 = HappyAbsSyn HappyAny #if __GLASGOW_HASKELL__ >= 607@@ -329,7 +329,7 @@ = case happyOut6 happy_x_1 of { happy_var_1 -> case happyOut13 happy_x_2 of { happy_var_2 -> happyIn4- (InfixCons happy_var_1 happy_var_2+ (mkInfixCons happy_var_1 happy_var_2 )}} #if __GLASGOW_HASKELL__ >= 710@@ -955,9 +955,32 @@ happyError [] = Nothing -- error ("Parser error at EOF") mkValue :: [Value] -> Value-mkValue [v] = v-mkValue (Con x [] : vs) = Con x vs-mkValue vs = Con "" vs+mkValue [v] = v+mkValue (Con "" [] : vs) = mkValue vs+mkValue (Con x [] : vs) = Con x vs+mkValue (InfixCons v xs : Neg x : more)+ = mkValue (mkInfixCons v (xs ++ [("-",x)]) : more)+mkValue (v : Neg x : more) = mkValue (mkInfixCons v [("-",x)] : more)+mkValue vs = Con "" vs++{- When we see a sequence of thins:+1 2 3 + x + y+we parse it as:+1 2 (3 + x + y)++we do this to make parsing of dates to look a little nicer:++(2018-08-05) 09 : 31++ends up as++(2018-08-05) (09:31)+-}++mkInfixCons :: Value -> [(Name,Value)] -> Value+mkInfixCons (Con "" as) bs | not (null as) =+ Con "" (init as ++ [InfixCons (last as) bs])+mkInfixCons a bs = InfixCons a bs {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "<built-in>" #-}@@ -1013,7 +1036,7 @@ {-# LINE 10 "<command-line>" #-}-{-# LINE 1 "/home/diatchki/tools/ghc-8.2.1/lib/ghc-8.2.1/include/ghcversion.h" #-}+{-# LINE 1 "/home/diatchki/tools/ghc-8.4.1/lib/ghc-8.4.1/include/ghcversion.h" #-} @@ -1030,457 +1053,7 @@ {-# LINE 10 "<command-line>" #-}-{-# LINE 1 "/tmp/ghc23551_0/ghc_2.h" #-}------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+{-# LINE 1 "/tmp/ghc12202_0/ghc_2.h" #-}
pretty-show.cabal view
@@ -1,5 +1,5 @@ name: pretty-show-version: 1.7+version: 1.8 category: Text synopsis: Tools for working with derived `Show` instances and generic