packages feed

ansi-pretty 0.1.2.0 → 0.1.2.1

raw patch · 3 files changed

+34/−15 lines, 3 filesdep ~aesondep ~basedep ~containersPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson, base, containers, generics-sop, time, vector

API changes (from Hackage documentation)

- Data.List.CommonPrefix: instance GHC.Generics.Constructor Data.List.CommonPrefix.C1_0CommonPrefix
- Data.List.CommonPrefix: instance GHC.Generics.Datatype Data.List.CommonPrefix.D1CommonPrefix
- Text.PrettyPrint.ANSI.Leijen.AnsiPretty: instance forall (k :: BOX) (t :: k) a. Text.PrettyPrint.ANSI.Leijen.AnsiPretty.AnsiPretty a => Text.PrettyPrint.ANSI.Leijen.AnsiPretty.AnsiPretty (Data.Tagged.Tagged t a)
+ Text.PrettyPrint.ANSI.Leijen.AnsiPretty: instance forall k a (t :: k). Text.PrettyPrint.ANSI.Leijen.AnsiPretty.AnsiPretty a => Text.PrettyPrint.ANSI.Leijen.AnsiPretty.AnsiPretty (Data.Tagged.Tagged t a)
- Text.PrettyPrint.ANSI.Leijen.AnsiPretty: ansiPretty :: AnsiPretty a => a -> Doc
+ Text.PrettyPrint.ANSI.Leijen.AnsiPretty: ansiPretty :: (AnsiPretty a, Generic a, All2 AnsiPretty (GCode a), GFrom a, GDatatypeInfo a, SListI (GCode a)) => a -> Doc
- Text.PrettyPrint.ANSI.Leijen.AnsiPretty: ghcAnsiPretty :: (Generic a, All2 AnsiPretty (GCode a), GFrom a, GDatatypeInfo a, SListI (GCode a)) => a -> Doc
+ Text.PrettyPrint.ANSI.Leijen.AnsiPretty: ghcAnsiPretty :: forall a. (Generic a, All2 AnsiPretty (GCode a), GFrom a, GDatatypeInfo a, SListI (GCode a)) => a -> Doc
- Text.PrettyPrint.ANSI.Leijen.AnsiPretty: ghcAnsiPrettyWith :: (Generic a, All2 AnsiPretty (GCode a), GFrom a, GDatatypeInfo a, SListI (GCode a)) => AnsiPrettyOpts -> a -> Doc
+ Text.PrettyPrint.ANSI.Leijen.AnsiPretty: ghcAnsiPrettyWith :: forall a. (Generic a, All2 AnsiPretty (GCode a), GFrom a, GDatatypeInfo a, SListI (GCode a)) => AnsiPrettyOpts -> a -> Doc
- Text.PrettyPrint.ANSI.Leijen.AnsiPretty: sopAnsiPretty :: (Generic a, HasDatatypeInfo a, All2 AnsiPretty (Code a)) => a -> Doc
+ Text.PrettyPrint.ANSI.Leijen.AnsiPretty: sopAnsiPretty :: forall a. (Generic a, HasDatatypeInfo a, All2 AnsiPretty (Code a)) => a -> Doc
- Text.PrettyPrint.ANSI.Leijen.AnsiPretty: sopAnsiPrettyWith :: (Generic a, HasDatatypeInfo a, All2 AnsiPretty (Code a)) => AnsiPrettyOpts -> a -> Doc
+ Text.PrettyPrint.ANSI.Leijen.AnsiPretty: sopAnsiPrettyWith :: forall a. (Generic a, HasDatatypeInfo a, All2 AnsiPretty (Code a)) => AnsiPrettyOpts -> a -> Doc

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.1.2.1++- Fix compilation issue with generics-sop-0.2.3.0+ # 0.1.2.0  - `AnsiPretty` for other types in `time`
ansi-pretty.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.9.0.+-- This file has been generated from package.yaml by hpack version 0.14.1. -- -- see: https://github.com/sol/hpack  name:           ansi-pretty-version:        0.1.2.0+version:        0.1.2.1 synopsis:       AnsiPretty for ansi-wl-pprint description:    'AnsiPretty' type class, more colorful than 'Pretty'. category:       Web@@ -13,7 +13,7 @@ maintainer:     Oleg Grenrus <oleg.grenrus@iki.fi> license:        BSD3 license-file:   LICENSE-tested-with:    GHC==7.8.4, GHC==7.10.2+tested-with:    GHC==7.8.4, GHC==7.10.3, GHC==8.0.1 build-type:     Simple cabal-version:  >= 1.10 @@ -30,10 +30,10 @@       src   ghc-options: -Wall   build-depends:-      aeson                 >=0.8   && <0.11+      aeson                 >=0.8   && <1.1     , ansi-wl-pprint        >=0.6   && <0.7     , array                 >=0.5   && <0.6-    , base                  >=4.7   && <4.9+    , base                  >=4.7   && <4.10     , bytestring            >=0.10  && <0.11     , containers            >=0.5   && <0.6     , generics-sop          >=0.1   && <0.3@@ -42,7 +42,7 @@     , semigroups            >=0.16  && <0.19     , tagged                >=0.7   && <0.9     , text                  >=1.2   && <1.3-    , time                  >=1.4   && <1.6+    , time                  >=1.4   && <1.7     , unordered-containers  >=0.2   && <0.3     , vector                >=0.10  && <0.12   exposed-modules:
src/Text/PrettyPrint/ANSI/Leijen/AnsiPretty.hs view
@@ -50,6 +50,7 @@ import qualified Text.PrettyPrint.ANSI.Leijen #endif +import qualified Text.PrettyPrint.ANSI.Leijen as L import qualified Data.Foldable as Foldable  -- For instances@@ -67,7 +68,7 @@ import qualified Data.Ratio as Ratio import qualified Data.Fixed as Fixed import qualified Data.Sequence as Seq-import qualified Data.Scientific as Scientfic+import qualified Data.Scientific as Sci import qualified Data.Set as Set import qualified Data.Tagged as Tagged import qualified Data.Text as ST@@ -145,7 +146,7 @@ sopAnsiPrettyS :: (All2 AnsiPretty xss) => AnsiPrettyOpts -> SOP I xss -> DatatypeInfo xss -> Doc sopAnsiPrettyS  opts (SOP (Z (I x :* Nil))) (Newtype _ _ ci)  = poPrettyNewtype opts (constructorName ci) (ansiPretty x) sopAnsiPrettyS  opts (SOP (Z xs)) (ADT _ _ (ci :* Nil)) = poPrettyRecord opts (constructorName ci) (gAnsiPrettyP xs (fieldInfo ci))-sopAnsiPrettyS _opts (SOP (Z _ )) _ = error "gAnsiPrettyS: redundant Z case"+sopAnsiPrettyS _opts (SOP (Z _ )) _ = error "gAnsiPrettyS: redundant Z case" -- TODO sopAnsiPrettyS  opts (SOP (S xss)) (ADT m d (_ :* cis)) = sopAnsiPrettyS opts (SOP xss) (ADT m d cis) sopAnsiPrettyS _opts (SOP (S _)) _  = error "gAnsiPrettyS: redundant S case" @@ -154,10 +155,12 @@ gAnsiPrettyP (I x :* xs) (FieldInfo fieldName :* fis) = (fieldName, ansiPretty x) : gAnsiPrettyP xs fis gAnsiPrettyP _ _ = error "gAnsiPrettyP: redundant case" +#if !MIN_VERSION_generics_sop(0,2,3) constructorName :: ConstructorInfo a -> ConstructorName constructorName (Constructor name) = name constructorName (Infix name _ _) = name constructorName (Record name _) = name+#endif  fieldInfo :: ConstructorInfo xs -> NP FieldInfo xs fieldInfo (Constructor _) = constructorFieldInfos 0 sList@@ -236,13 +239,25 @@  -- aeson instance AnsiPretty Aeson.Value where-  ansiPretty (Aeson.Object o) = ansiPretty o-  ansiPretty (Aeson.Array a)  = ansiPretty a-  ansiPretty (Aeson.String s) = ansiPretty s-  ansiPretty (Aeson.Number s) = ansiPretty s-  ansiPretty (Aeson.Bool b)   = ansiPretty b-  ansiPretty Aeson.Null       = cyan (text "Null")+    ansiPretty (Aeson.Object o)+        = encloseSep (dullgreen lbrace) (dullgreen rbrace) (dullgreen comma)+        $ fmap f $ HashMap.toList o+      where+        f (k, v) = dullwhite (ansiPretty k) L.<> blue colon <+> ansiPretty v +    ansiPretty (Aeson.Array a)+        = encloseSep (dullgreen lbracket) (dullgreen rbracket) (dullgreen comma)+        $ fmap ansiPretty $ V.toList a++    ansiPretty (Aeson.Number s)+        = maybe (ansiPretty s) (ansiPretty :: Int -> Doc)+        $ Sci.toBoundedInteger s++    ansiPretty (Aeson.String s)   = ansiPretty (show s)+    ansiPretty (Aeson.Bool True)  = dullyellow $ string "true"+    ansiPretty (Aeson.Bool False) = dullyellow $ string "false"+    ansiPretty Aeson.Null         = cyan (text "Null")+ -- array instance (AnsiPretty i, AnsiPretty e, Array.Ix i) => AnsiPretty (Array.Array i e) where ansiPretty = ansiPrettyMap "Array" . Array.assocs instance (AnsiPretty i, AnsiPretty e, Array.Ix i, Array.IArray Array.UArray e) => AnsiPretty (Array.UArray i e) where ansiPretty = ansiPrettyMap "UArray" . Array.assocs@@ -277,7 +292,7 @@ instance (AnsiPretty a, AnsiPretty b) => AnsiPretty (Arg a b)  -- scientific-instance AnsiPretty Scientfic.Scientific where ansiPretty = dullyellow . text . show+instance AnsiPretty Sci.Scientific where ansiPretty = dullyellow . text . show  -- tagged instance AnsiPretty a => AnsiPretty (Tagged.Tagged t a) where ansiPretty = ansiPretty . Tagged.untag