mainland-pretty 0.1.2.0 → 0.1.3.0
raw patch · 2 files changed
+20/−20 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.PrettyPrint.Mainland: instance [overlap ok] Pretty Rational
- Text.PrettyPrint.Mainland: instance [overlap ok] Pretty a => Show a
+ Text.PrettyPrint.Mainland: instance [overlap ok] (Integral a, Pretty a) => Pretty (Ratio a)
Files
- Text/PrettyPrint/Mainland.hs +19/−19
- mainland-pretty.cabal +1/−1
Text/PrettyPrint/Mainland.hs view
@@ -1,11 +1,3 @@-{-# LANGUAGE BangPatterns #-}-{-# LANGUAGE CPP #-}-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE OverlappingInstances #-}-{-# LANGUAGE TypeSynonymInstances #-}-{-# LANGUAGE UndecidableInstances #-}- -- Copyright (c) 2006-2012 -- The President and Fellows of Harvard College. --@@ -56,6 +48,10 @@ -- #line pragmas. -------------------------------------------------------------------------------- +{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE OverlappingInstances #-}+ module Text.PrettyPrint.Mainland ( -- * The document type Doc,@@ -110,6 +106,7 @@ import qualified Data.Set as Set import Data.Symbol import Data.Word+import GHC.Real (Ratio(..)) infixr 5 </>, <+/>, <//> infixr 6 <+>@@ -568,18 +565,20 @@ fits !w (RPos _ x) = fits w x fits !_ (RLine _ _) = True -#if MIN_VERSION_base(4,5,0)-#else+#if !MIN_VERSION_base(4,5,0) infixr 6 <> (<>) :: Doc -> Doc -> Doc x <> y = x `Cat` y-#endif+#endif /* !MIN_VERSION_base(4,5,0) */ instance Monoid Doc where mempty = empty mappend = Cat +instance Show Doc where+ showsPrec _ = prettyS 80+ class Pretty a where ppr :: a -> Doc pprPrec :: Int -> a -> Doc@@ -601,9 +600,16 @@ instance Pretty Double where ppr = text . show -instance Pretty Rational where- ppr = text . show+ratioPrec, ratioPrec1 :: Int+ratioPrec = 7 -- Precedence of ':%' constructor+ratioPrec1 = ratioPrec + 1 +instance (Integral a, Pretty a) => Pretty (Ratio a) where+ {-# SPECIALIZE instance Pretty Rational #-}+ pprPrec p (x:%y) =+ parensIf (p > ratioPrec) $+ pprPrec ratioPrec1 x <+> char '%' <+> pprPrec ratioPrec1 y+ instance Pretty Bool where ppr = text . show @@ -629,12 +635,6 @@ instance Pretty a => Pretty (Maybe a) where pprPrec _ Nothing = empty pprPrec p (Just a) = pprPrec p a--instance Show Doc where- showsPrec _ = prettyS 80--instance Pretty a => Show a where- showsPrec p = showsPrec p . ppr instance Pretty Symbol where ppr = text . unintern
mainland-pretty.cabal view
@@ -1,5 +1,5 @@ name: mainland-pretty-version: 0.1.2.0+version: 0.1.3.0 cabal-version: >= 1.6 license: BSD3 license-file: LICENSE