text-show 3.9.2 → 3.9.3
raw patch · 49 files changed
+204/−688 lines, 49 filesdep ~basedep ~deriving-compatdep ~generic-deriving
Dependency ranges changed: base, deriving-compat, generic-deriving, ghc-boot-th, quickcheck-instances, template-haskell, th-abstraction
Files
- CHANGELOG.md +8/−0
- shared/TextShow/TH/Names.hs +0/−17
- src/TextShow/Classes.hs +0/−11
- src/TextShow/Control/Applicative.hs +1/−4
- src/TextShow/Control/Exception.hs +1/−7
- src/TextShow/Data/Fixed.hs +6/−22
- src/TextShow/Data/Floating.hs +0/−17
- src/TextShow/Data/Integral.hs +2/−13
- src/TextShow/Data/OldTypeable.hs +2/−2
- src/TextShow/Data/Proxy.hs +1/−4
- src/TextShow/Data/Tuple.hs +21/−2
- src/TextShow/Data/Type/Coercion.hs +0/−7
- src/TextShow/Data/Type/Equality.hs +1/−6
- src/TextShow/Data/Typeable.hs +1/−4
- src/TextShow/Debug/Trace.hs +1/−4
- src/TextShow/FromStringTextShow.hs +7/−45
- src/TextShow/GHC/TypeLits.hs +5/−57
- src/TextShow/Generic.hs +8/−38
- src/TextShow/Options.hs +0/−2
- src/TextShow/TH/Internal.hs +23/−47
- src/TextShow/Text/Read.hs +3/−11
- src/TextShow/Utils.hs +1/−18
- tests/Derived/DataFamilies.hs +13/−32
- tests/Derived/Infix.hs +4/−29
- tests/Derived/MagicHash.hs +23/−4
- tests/Derived/PolyKinds.hs +8/−49
- tests/Derived/Records.hs +3/−22
- tests/Derived/TypeFamilies.hs +1/−12
- tests/Derived/TypeSynonyms.hs +1/−12
- tests/Instances/Control/Exception.hs +0/−2
- tests/Instances/Data/OldTypeable.hs +2/−2
- tests/Instances/Data/Tuple.hs +1/−1
- tests/Instances/Data/Type/Coercion.hs +0/−6
- tests/Instances/Data/Type/Equality.hs +1/−5
- tests/Instances/Data/Typeable.hs +1/−5
- tests/Instances/GHC/TypeLits.hs +1/−23
- tests/Instances/Generic.hs +1/−10
- tests/Instances/Text/Read.hs +4/−24
- tests/Spec/Control/ExceptionSpec.hs +0/−2
- tests/Spec/Data/OldTypeableSpec.hs +3/−3
- tests/Spec/Data/TupleSpec.hs +13/−0
- tests/Spec/Data/Type/CoercionSpec.hs +5/−13
- tests/Spec/Data/TypeableSpec.hs +0/−3
- tests/Spec/Derived/DataFamiliesSpec.hs +3/−19
- tests/Spec/Derived/TypeFamiliesSpec.hs +0/−10
- tests/Spec/GHC/GenericsSpec.hs +1/−4
- tests/Spec/GHC/TypeLitsSpec.hs +6/−30
- tests/Spec/Text/ReadSpec.hs +2/−11
- text-show.cabal +15/−17
CHANGELOG.md view
@@ -1,3 +1,11 @@+### 3.9.3 [2021.10.31]+* Allow building with GHC 9.2.+* Drop support for GHC 7.4 and 7.6.+* Add `TextShow(1)` instances for `Solo` when building with `ghc-prim-0.7` or+ later.+* Support deriving `TextShow(1)(2)` instances for data types with fields+ of type `Int32#` or `Word32#` on GHC 8.2 or later.+ ### 3.9.2 [2021.08.30] * Require `generic-deriving-1.14.1` or later in the test suite.
@@ -17,9 +17,6 @@ fdKeyTypeName, uniqueTypeName, asInt64ValName,-#if MIN_VERSION_base(4,6,0)- numberTypeName,-#endif #if MIN_VERSION_base(4,8,0) giveGCStatsTypeName, doCostCentresTypeName,@@ -30,10 +27,6 @@ import Language.Haskell.TH.Syntax -#if MIN_VERSION_base(4,7,0)-import Text.Read.Lex (Number)-#endif- #if MIN_VERSION_base(4,8,2) import GHC.RTS.Flags (GiveGCStats, DoCostCentres, DoHeapProfile, DoTrace) #endif@@ -70,16 +63,6 @@ asInt64ValName = mkNameG_v "base" "GHC.Event.Unique" "asInt" #else asInt64ValName = mkNameG_v "base" "GHC.Event.Unique" "asInt64"-#endif--#if MIN_VERSION_base(4,6,0)--- | The 'Name' of 'Number'.-numberTypeName :: Name-# if MIN_VERSION_base(4,7,0)-numberTypeName = ''Number-# else-numberTypeName = mkNameG_tc "base" "Text.Read.Lex" "Number"-# endif #endif #if MIN_VERSION_base(4,8,0)
src/TextShow/Classes.hs view
@@ -1,10 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-}--#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE StandaloneDeriving #-}-#endif {-| Module: TextShow.Classes Copyright: (C) 2014-2017 Ryan Scott@@ -17,9 +14,7 @@ -} module TextShow.Classes where -#if __GLASGOW_HASKELL__ >= 708 import Data.Data (Typeable)-#endif import qualified Data.Text as TS (Text, singleton) import qualified Data.Text.IO as TS (putStrLn, hPutStrLn) import qualified Data.Text.Lazy as TL (Text, singleton)@@ -175,11 +170,9 @@ -> TL.Text showtlList = toLazyText . showbList -#if __GLASGOW_HASKELL__ >= 708 {-# MINIMAL showbPrec | showb #-} deriving instance Typeable TextShow-#endif -- | Surrounds 'Builder' output with parentheses if the 'Bool' parameter is 'True'. --@@ -417,11 +410,9 @@ -> [f a] -> Builder liftShowbList sp sl = showbListWith (liftShowbPrec sp sl 0) -#if __GLASGOW_HASKELL__ >= 708 {-# MINIMAL liftShowbPrec #-} deriving instance Typeable TextShow1-#endif -- | Lift the standard 'showbPrec' and 'showbList' functions through the -- type constructor.@@ -487,11 +478,9 @@ liftShowbList2 sp1 sl1 sp2 sl2 = showbListWith (liftShowbPrec2 sp1 sl1 sp2 sl2 0) -#if __GLASGOW_HASKELL__ >= 708 {-# MINIMAL liftShowbPrec2 #-} deriving instance Typeable TextShow2-#endif -- | Lift two 'showbPrec' functions through the type constructor. --
src/TextShow/Control/Applicative.hs view
@@ -1,10 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-}-#endif+{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-|
src/TextShow/Control/Exception.hs view
@@ -59,9 +59,7 @@ showb LossOfPrecision = "loss of precision" showb DivideByZero = "divide by zero" showb Denormal = "denormal"-#if MIN_VERSION_base(4,6,0) showb RatioZeroDenominator = "Ratio has zero denominator"-#endif -- | /Since: 2/ instance TextShow ArrayException where@@ -80,14 +78,10 @@ showb (AssertionFailed err) = fromString err {-# INLINE showb #-} -#if MIN_VERSION_base(4,7,0)--- | Only available with @base-4.7.0.0@ or later.------ /Since: 2/+-- | /Since: 2/ instance TextShow SomeAsyncException where showb (SomeAsyncException e) = showb $ FromStringShow e {-# INLINE showb #-}-#endif -- | /Since: 2/ instance TextShow AsyncException where
src/TextShow/Data/Fixed.hs view
@@ -14,26 +14,17 @@ -} module TextShow.Data.Fixed (showbFixed) where -import Data.Fixed (HasResolution(..))-import Data.Text.Lazy.Builder (Builder)+import Data.Fixed (Fixed(..), HasResolution(..))+import Data.Int (Int64)+import Data.Semigroup.Compat (mtimesDefault)+import Data.Text.Lazy.Builder (Builder, singleton) import Prelude () import Prelude.Compat import TextShow.Classes (TextShow(..))--#if MIN_VERSION_base(4,7,0)-import Data.Fixed (Fixed(..))-import Data.Int (Int64)-import Data.Semigroup.Compat (mtimesDefault)-import Data.Text.Lazy.Builder (singleton)- import TextShow.Data.Integral () import TextShow.Utils (lengthB)-#else-import Data.Fixed (Fixed, showFixed)-import Data.Text.Lazy.Builder (fromString)-#endif #if MIN_VERSION_base(4,13,0) import TextShow.Classes (showbParen)@@ -44,7 +35,6 @@ -- -- /Since: 2/ showbFixed :: HasResolution a => Bool -> Fixed a -> Builder-#if MIN_VERSION_base(4,7,0) showbFixed chopTrailingZeroes fa@(MkFixed a) | a < 0 = singleton '-' <> showbFixed chopTrailingZeroes (asTypeOf (MkFixed (negate a)) fa) showbFixed chopTrailingZeroes fa@(MkFixed a)@@ -54,18 +44,13 @@ (i, d) = divMod (fromInteger a) res digits = ceiling (logBase 10 (fromInteger $ resolution fa) :: Double) maxnum = 10 ^ digits-# if MIN_VERSION_base(4,8,0)+#if MIN_VERSION_base(4,8,0) fracNum = divCeil (d * maxnum) res divCeil x y = (x + y - 1) `div` y-# else- fracNum = div (d * maxnum) res-# endif #else-showbFixed chopTrailingZeroes = fromString . showFixed chopTrailingZeroes-{-# INLINE showbFixed #-}+ fracNum = div (d * maxnum) res #endif -#if MIN_VERSION_base(4,7,0) -- | Only works for positive 'Integer's. showbIntegerZeroes :: Bool -> Int64 -> Integer -> Builder showbIntegerZeroes True _ 0 = mempty@@ -87,7 +72,6 @@ withDotB b | b == mempty = mempty | otherwise = singleton '.' <> b {-# INLINE withDotB #-}-#endif -- | /Since: 2/ instance HasResolution a => TextShow (Fixed a) where
src/TextShow/Data/Floating.hs view
@@ -361,7 +361,6 @@ (map fromIntegral (reverse rds), k) roundTo :: Int -> [Int] -> (Int,[Int])-#if MIN_VERSION_base(4,6,0) roundTo d is = case f d True is of x@(0,_) -> x@@ -380,22 +379,6 @@ (c,ds) = f (n-1) (even i) xs i' = c + i base = 10-#else-roundTo d is =- case f d is of- x@(0,_) -> x- (1,xs) -> (1, 1:xs)- _ -> error "roundTo: bad Value"- where- f n [] = (0, replicate n 0)- f 0 (x:_) = (if x >= 5 then 1 else 0, [])- f n (i:xs)- | i' == 10 = (1,0:ds)- | otherwise = (0,i':ds)- where- (c,ds) = f (n-1) xs- i' = c + i-#endif -- Exponentiation with a cache for the most common numbers.
src/TextShow/Data/Integral.hs view
@@ -28,10 +28,7 @@ import Data.Text.Lazy.Builder.Int (decimal) import Data.Word (Word8, Word16, Word32, Word64) -import GHC.Exts (Int(I#), (<#), (>#))-#if __GLASGOW_HASKELL__ >= 708-import GHC.Exts (Int#, isTrue#)-#endif+import GHC.Exts (Int(I#), (<#), (>#), isTrue#) import Prelude () import Prelude.Compat@@ -102,18 +99,10 @@ -- | /Since: 2/ instance TextShow Int where showbPrec (I# p) n'@(I# n)- | isTrue (n <# 0#) && isTrue (p ># 6#)+ | isTrue# (n <# 0#) && isTrue# (p ># 6#) = singleton '(' <> decimal n' <> singleton ')' | otherwise = decimal n'- where-#if __GLASGOW_HASKELL__ >= 708- isTrue :: Int# -> Bool- isTrue b = isTrue# b-#else- isTrue :: Bool -> Bool- isTrue = id-#endif -- | /Since: 2/ instance TextShow Int8 where
src/TextShow/Data/OldTypeable.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} -#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-} #endif@@ -19,7 +19,7 @@ -} module TextShow.Data.OldTypeable () where -#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) import Data.OldTypeable.Internal (TyCon(TyCon, tyConName), TypeRep(..), funTc, listTc) import Data.Text.Lazy.Builder (fromString, singleton)
src/TextShow/Data/Proxy.hs view
@@ -1,10 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-}-#endif+{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
src/TextShow/Data/Tuple.hs view
@@ -1,5 +1,6 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: TextShow.Data.Tuple@@ -15,6 +16,12 @@ -} module TextShow.Data.Tuple () where +#if MIN_VERSION_ghc_prim(0,7,0)+import GHC.Tuple (Solo(..))+import TextShow.Classes (TextShow(..), TextShow1(..),+ showbPrec1, showbUnaryWith)+#endif+ import TextShow.TH.Internal (deriveTextShow, deriveTextShow1, deriveTextShow2) -- The Great Pyramids of Template Haskell@@ -106,3 +113,15 @@ $(deriveTextShow2 ''(,,,,,,,,,,,,,)) -- | /Since: 2/ $(deriveTextShow2 ''(,,,,,,,,,,,,,,))++#if MIN_VERSION_ghc_prim(0,7,0)+-- | /Since: 3.9.3/+instance TextShow a => TextShow (Solo a) where+ showbPrec = showbPrec1+ {-# INLINE showbPrec #-}++-- | /Since: 3.9.3/+instance TextShow1 Solo where+ liftShowbPrec sp _ p (Solo x) = showbUnaryWith sp "Solo" p x+ {-# INLINE liftShowbPrec #-}+#endif
src/TextShow/Data/Type/Coercion.hs view
@@ -1,11 +1,7 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,7,0) {-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-}-#endif {-| Module: TextShow.Data.Type.Coercion Copyright: (C) 2014-2017 Ryan Scott@@ -15,13 +11,11 @@ Portability: GHC 'TextShow' instance for representational equality.-Only provided if using @base-4.7.0.0@ or later. /Since: 2/ -} module TextShow.Data.Type.Coercion () where -#if MIN_VERSION_base(4,7,0) import Data.Type.Coercion (Coercion) import TextShow.Classes (TextShow1(..))@@ -36,4 +30,3 @@ -- | /Since: 2/ $(deriveTextShow2 ''Coercion)-#endif
src/TextShow/Data/Type/Equality.hs view
@@ -1,12 +1,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeOperators #-}--#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE PolyKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: TextShow.Data.Type.Equality@@ -17,7 +13,6 @@ Portability: GHC 'TextShow' instance for propositional equality.-Only provided if using @base-4.7.0.0@ or later. /Since: 2/ -}
src/TextShow/Data/Typeable.hs view
@@ -2,11 +2,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MagicHash #-}-{-# LANGUAGE OverloadedStrings #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-}-#endif+{-# LANGUAGE OverloadedStrings #-} #if __GLASGOW_HASKELL__ >= 801 {-# LANGUAGE PatternSynonyms #-}
src/TextShow/Debug/Trace.hs view
@@ -45,14 +45,13 @@ , tracetlEvent , tracetEventIO , tracetlEventIO-#if MIN_VERSION_base(4,7,0)+ -- * Execution phase markers -- $markers , tracetMarker , tracetlMarker , tracetMarkerIO , tracetlMarkerIO-#endif ) where import Control.Monad (unless)@@ -299,7 +298,6 @@ tracetlEventIO :: TL.Text -> IO () tracetlEventIO = traceEventIO . TL.unpack -#if MIN_VERSION_base(4,7,0) -- $markers -- -- When looking at a profile for the execution of a program we often want to@@ -356,4 +354,3 @@ -- /Since: 2/ tracetlMarkerIO :: TL.Text -> IO () tracetlMarkerIO = traceMarkerIO . TL.unpack-#endif
src/TextShow/FromStringTextShow.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-}@@ -7,16 +8,12 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE PolyKinds #-}-#endif- #if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DeriveLift #-} #endif@@ -46,6 +43,7 @@ import Data.Bifunctor.TH (deriveBifunctor, deriveBifoldable, deriveBitraversable)+import Data.Coerce (coerce) import Data.Data (Data, Typeable) import Data.Functor.Classes (Show1(..)) @@ -53,9 +51,7 @@ import qualified Generics.Deriving.TH as Generics #endif -#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic, Generic1)-#endif import Language.Haskell.TH.Lift @@ -69,7 +65,6 @@ showbPrec1, showbPrec2, showbPrecToShowsPrec, showsPrecToShowbPrec, showbToShows, showsToShowb)-import TextShow.Utils (coerce) #if defined(NEW_FUNCTOR_CLASSES) import Data.Functor.Classes (Show2(..), showsPrec1, showsPrec2)@@ -93,10 +88,8 @@ , Eq , Foldable , Functor-#if __GLASGOW_HASKELL__ >= 706 , Generic , Generic1-#endif #if __GLASGOW_HASKELL__ >= 800 , Lift #endif@@ -157,10 +150,8 @@ , Eq , Foldable , Functor-#if __GLASGOW_HASKELL__ >= 706 , Generic , Generic1-#endif #if __GLASGOW_HASKELL__ >= 800 , Lift #endif@@ -219,11 +210,9 @@ newtype FromStringShow1 f a = FromStringShow1 { fromStringShow1 :: f a } deriving ( Eq , Ord-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif #if __GLASGOW_HASKELL__ >= 800 , Data@@ -242,12 +231,9 @@ deriving instance Functor f => Functor (FromStringShow1 f) deriving instance Foldable f => Foldable (FromStringShow1 f) deriving instance Traversable f => Traversable (FromStringShow1 f)--# if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable FromStringShow1 deriving instance ( Data (f a), Typeable f, Typeable a ) => Data (FromStringShow1 f (a :: *))-# endif #endif instance Read (f a) => Read (FromStringShow1 f a) where@@ -300,11 +286,9 @@ newtype FromTextShow1 f a = FromTextShow1 { fromTextShow1 :: f a } deriving ( Eq , Ord-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif #if __GLASGOW_HASKELL__ >= 800 , Data@@ -321,12 +305,9 @@ deriving instance Functor f => Functor (FromTextShow1 f) deriving instance Foldable f => Foldable (FromTextShow1 f) deriving instance Traversable f => Traversable (FromTextShow1 f)--# if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable FromTextShow1 deriving instance ( Data (f a), Typeable f, Typeable a ) => Data (FromTextShow1 f (a :: *))-# endif #endif instance Read (f a) => Read (FromTextShow1 f a) where@@ -384,11 +365,9 @@ newtype FromStringShow2 f a b = FromStringShow2 { fromStringShow2 :: f a b } deriving ( Eq , Ord-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif #if __GLASGOW_HASKELL__ >= 800 , Data@@ -403,12 +382,9 @@ deriving instance Functor (f a) => Functor (FromStringShow2 f a) deriving instance Foldable (f a) => Foldable (FromStringShow2 f a) deriving instance Traversable (f a) => Traversable (FromStringShow2 f a)--# if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable FromStringShow2 deriving instance ( Data (f a b), Typeable f, Typeable a, Typeable b ) => Data (FromStringShow2 f (a :: *) (b :: *))-# endif #endif instance Read (f a b) => Read (FromStringShow2 f a b) where@@ -484,11 +460,9 @@ newtype FromTextShow2 f a b = FromTextShow2 { fromTextShow2 :: f a b } deriving ( Eq , Ord-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif #if __GLASGOW_HASKELL__ >= 800 , Data@@ -505,12 +479,9 @@ deriving instance Functor (f a) => Functor (FromTextShow2 f a) deriving instance Foldable (f a) => Foldable (FromTextShow2 f a) deriving instance Traversable (f a) => Traversable (FromTextShow2 f a)--# if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable FromTextShow2 deriving instance ( Data (f a b), Typeable f, Typeable a, Typeable b ) => Data (FromTextShow2 f (a :: *) (b :: *))-# endif #endif instance Read (f a b) => Read (FromTextShow2 f a b) where@@ -612,13 +583,4 @@ $(Generics.deriveRepresentable1 ''FromStringShow2) $(Generics.deriveMeta ''FromTextShow2) $(Generics.deriveRepresentable1 ''FromTextShow2)-#endif--#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveAll0And1 ''FromStringShow)-$(Generics.deriveAll0And1 ''FromTextShow)-$(Generics.deriveRepresentable0 ''FromStringShow1)-$(Generics.deriveRepresentable0 ''FromStringShow2)-$(Generics.deriveRepresentable0 ''FromTextShow1)-$(Generics.deriveRepresentable0 ''FromTextShow2) #endif
src/TextShow/GHC/TypeLits.hs view
@@ -1,17 +1,4 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,6,0)-# if !(MIN_VERSION_base(4,7,0))-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE KindSignatures #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE UndecidableInstances #-}-# endif- {-# OPTIONS_GHC -fno-warn-orphans #-}-#endif {-| Module: TextShow.GHC.TypeLits Copyright: (C) 2014-2017 Ryan Scott@@ -21,65 +8,26 @@ Portability: GHC 'TextShow' instances for data types in the @GHC.TypeLits@ module.-Only provided if using @base-4.6.0.0@ or later. /Since: 2/ -} module TextShow.GHC.TypeLits () where -#if MIN_VERSION_base(4,6,0)+import GHC.TypeLits (SomeNat(..), SomeSymbol(..), natVal, symbolVal)+ import Prelude () import Prelude.Compat import TextShow.Classes (TextShow(..))-import TextShow.Data.Integral ()--# if MIN_VERSION_base(4,7,0)-import GHC.TypeLits (SomeNat(..), SomeSymbol(..), natVal, symbolVal) import TextShow.Data.Char ()-# else-import Data.Text.Lazy.Builder (singleton)-import GHC.TypeLits (IsEven(..), IsZero(..), Kind, Sing, SingE(fromSing))-# endif+import TextShow.Data.Integral () -# if MIN_VERSION_base(4,7,0)--- | Only available with @base-4.7.0.0@ or later.------ /Since: 2/+-- | /Since: 2/ instance TextShow SomeNat where showbPrec p (SomeNat x) = showbPrec p $ natVal x {-# INLINE showbPrec #-} --- | Only available with @base-4.7.0.0@ or later.------ /Since: 2/+-- | /Since: 2/ instance TextShow SomeSymbol where showb (SomeSymbol x) = showbList $ symbolVal x {-# INLINE showb #-}-# else--- | Only available with @base-4.6@.------ /Since: 2/-instance TextShow (IsEven n) where- showb IsEvenZero = singleton '0'- showb (IsEven x) = "(2 * " <> showb x <> singleton ')'- showb (IsOdd x) = "(2 * " <> showb x <> " + 1)"- {-# INLINE showb #-}---- | Only available with @base-4.6@.------ /Since: 2/-instance TextShow (IsZero n) where- showb IsZero = singleton '0'- showb (IsSucc n) = singleton '(' <> showb n <> " + 1)"- {-# INLINE showb #-}---- | Only available with @base-4.6@.------ /Since: 2/-instance (SingE (Kind :: k) rep, TextShow rep) => TextShow (Sing (a :: k)) where- showbPrec p = showbPrec p . fromSing- {-# INLINE showbPrec #-}-# endif--#endif
src/TextShow/Generic.hs view
@@ -1,10 +1,12 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE EmptyCase #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -12,6 +14,7 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeOperators #-}@@ -20,15 +23,6 @@ {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE PolyKinds #-}-#endif--#if __GLASGOW_HASKELL__ >= 708-{-# LANGUAGE EmptyCase #-}-#endif- #if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE DeriveLift #-} #endif@@ -196,15 +190,13 @@ , Eq , Foldable , Functor+ , Generic+ , Generic1 , Ord , Read , Show , Traversable , Typeable-#if __GLASGOW_HASKELL__ >= 706- , Generic- , Generic1-#endif #if __GLASGOW_HASKELL__ >= 800 , Lift #endif@@ -228,9 +220,7 @@ , Ord , Read , Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-#endif #if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1 #endif@@ -242,12 +232,9 @@ deriving instance Foldable f => Foldable (FromGeneric1 f) deriving instance Functor f => Functor (FromGeneric1 f) deriving instance Traversable f => Traversable (FromGeneric1 f)--#if __GLASGOW_HASKELL__ >= 708 deriving instance Typeable FromGeneric1 deriving instance ( Data (f a), Typeable f, Typeable a ) => Data (FromGeneric1 f (a :: *))-#endif -- | /Since: 3.7.4/ instance (Generic1 f, GTextShowB One (Rep1 f)) => TextShow1 (FromGeneric1 f) where@@ -394,12 +381,6 @@ See #33. -} -#if __GLASGOW_HASKELL__ >= 708-#define DERIVE_TYPEABLE(name) deriving instance Typeable name-#else-#define DERIVE_TYPEABLE(name)-#endif- #if __GLASGOW_HASKELL__ >= 711 #define HASH_FUNS(text_type,one_hash,two_hash,hash_prec,from_char,from_string) \ one_hash, two_hash :: text_type; \@@ -416,12 +397,6 @@ hash_prec = id #endif -#if __GLASGOW_HASKELL__ >= 708-#define EMPTY_CASE(x) case x of {}-#else-#define EMPTY_CASE(x) case x of !_ -> undefined-#endif- #define GTEXT_SHOW(text_type,show_funs,no_show_funs,show1_funs,one_hash,two_hash,hash_prec,gtext_show,gshow_prec,gtext_show_con,gshow_prec_con,show_prec,lift_show_prec,show_space,show_paren,show_list_with,from_char,from_string) \ {- | A 'show_funs' value either stores nothing (for 'TextShow') or it stores \ the two function arguments that show occurrences of the type parameter (for \@@ -453,14 +428,14 @@ ; gshow_prec :: show_funs arity a -> Int -> f a -> text_type \ }; \ \-DERIVE_TYPEABLE(gtext_show); \+deriving instance Typeable gtext_show; \ \ instance gtext_show arity f => gtext_show arity (D1 d f) where { \ gshow_prec sfs p (M1 x) = gshow_prec sfs p x \ }; \ \ instance gtext_show arity V1 where { \- gshow_prec _ _ x = EMPTY_CASE(x) \+ gshow_prec _ _ x = case x of {} \ }; \ \ instance (gtext_show arity f, gtext_show arity g) => gtext_show arity (f :+: g) where { \@@ -522,7 +497,7 @@ ; gshow_prec_con :: ConType -> show_funs arity a -> Int -> f a -> text_type \ }; \ \-DERIVE_TYPEABLE(gtext_show_con); \+deriving instance Typeable gtext_show_con; \ \ instance gtext_show_con arity U1 where { \ gshow_prec_con _ _ _ U1 = mempty \@@ -675,9 +650,4 @@ #if !defined(__LANGUAGE_DERIVE_GENERIC1__) $(Generics.deriveMeta ''FromGeneric1) $(Generics.deriveRepresentable1 ''FromGeneric1)-#endif--#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveAll0And1 ''FromGeneric)-$(Generics.deriveRepresentable0 ''FromGeneric1) #endif
src/TextShow/Options.hs view
@@ -42,8 +42,6 @@ -- ^ If 'True', derived instances for empty data types (i.e., ones with -- no data constructors) will use the @EmptyCase@ language extension. -- If 'False', derived instances will simply use 'seq' instead.- -- (This has no effect on GHCs before 7.8, since @EmptyCase@ is only- -- available in 7.8 or later.) -- -- /Since: 3.7/ } deriving ( Data
src/TextShow/TH/Internal.hs view
@@ -79,8 +79,11 @@ #if MIN_VERSION_base(4,13,0) , Int8#, Int16#, Word8#, Word16# # if MIN_VERSION_base(4,16,0)- , int8ToInt#, int16ToInt#, intToInt8#, intToInt16#- , word8ToWord#, word16ToWord#, wordToWord8#, wordToWord16#+ , Int32#, Word32#+ , int8ToInt#, int16ToInt#, int32ToInt#+ , intToInt8#, intToInt16#, intToInt32#+ , word8ToWord#, word16ToWord#, word32ToWord#+ , wordToWord8#, wordToWord16#, wordToWord32# # else , extendInt8#, extendInt16#, extendWord8#, extendWord16# , narrowInt8#, narrowInt16#, narrowWord8#, narrowWord16#@@ -540,7 +543,7 @@ splMap = Map.fromList $ zip lastTyVars spls makeFun- | null cons && emptyCaseBehavior opts && ghc7'8OrLater+ | null cons && emptyCaseBehavior opts = caseE (varE value) [] | null cons@@ -558,13 +561,6 @@ , makeFun ] ++ map varE spsAndSls ++ [varE p, varE value]- where- ghc7'8OrLater :: Bool-#if __GLASGOW_HASKELL__ >= 708- ghc7'8OrLater = True-#else- ghc7'8OrLater = False-#endif -- | Generates a lambda expression for showbPrec/liftShowbPrec/etc. for a -- single constructor.@@ -1070,15 +1066,8 @@ -- Expanding type synonyms ------------------------------------------------------------------------------- -applySubstitutionKind :: Map Name Kind -> Type -> Type-#if MIN_VERSION_template_haskell(2,8,0)-applySubstitutionKind = applySubstitution-#else-applySubstitutionKind _ t = t-#endif- substNameWithKind :: Name -> Kind -> Type -> Type-substNameWithKind n k = applySubstitutionKind (Map.singleton n k)+substNameWithKind n k = applySubstitution (Map.singleton n k) substNamesWithKindStar :: [Name] -> Type -> Type substNamesWithKindStar ns t = foldr' (flip substNameWithKind starK) t ns@@ -1209,9 +1198,7 @@ canRealizeKindStar t | hasKindStar t = KindStar | otherwise = case t of-#if MIN_VERSION_template_haskell(2,8,0) SigT _ (VarT k) -> IsKindVar k-#endif _ -> NotKindStar -- | Returns 'Just' the kind variable 'Name' of a 'StarKindStatus' if it exists.@@ -1284,6 +1271,18 @@ , primShowConv = mkNarrowE wordToWord16HashValName }) #endif+#if MIN_VERSION_base(4,16,0)+ , (''Int32#, PrimShow+ { primShowBoxer = appE (conE 'I#) . appE (varE 'int32ToInt#)+ , primShowPostfixMod = oneHashE+ , primShowConv = mkNarrowE 'intToInt32#+ })+ , (''Word32#, PrimShow+ { primShowBoxer = appE (conE 'W#) . appE (varE 'word32ToWord#)+ , primShowPostfixMod = twoHashE+ , primShowConv = mkNarrowE 'wordToWord32#+ })+#endif ] #if MIN_VERSION_base(4,13,0)@@ -1377,21 +1376,13 @@ -- | Returns True if a Type has kind *. hasKindStar :: Type -> Bool hasKindStar VarT{} = True-#if MIN_VERSION_template_haskell(2,8,0) hasKindStar (SigT _ StarT) = True-#else-hasKindStar (SigT _ StarK) = True-#endif hasKindStar _ = False -- Returns True is a kind is equal to *, or if it is a kind variable. isStarOrVar :: Kind -> Bool-#if MIN_VERSION_template_haskell(2,8,0) isStarOrVar StarT = True isStarOrVar VarT{} = True-#else-isStarOrVar StarK = True-#endif isStarOrVar _ = False -- Generate a list of fresh names with a common prefix, and numbered suffixes.@@ -1403,7 +1394,7 @@ -- kind variables. hasKindVarChain :: Int -> Type -> Maybe [Name] hasKindVarChain kindArrows t =- let uk = uncurryKind (tyKind t)+ let uk = uncurryTy (tyKind t) in if (length uk - 1 == kindArrows) && all isStarOrVar uk then Just (concatMap freeVariables uk) else Nothing@@ -1500,18 +1491,15 @@ #if MIN_VERSION_template_haskell(2,11,0) FamilyI (OpenTypeFamilyD (TypeFamilyHead _ bndrs _ _)) _ -> withinFirstArgs bndrs-#elif MIN_VERSION_template_haskell(2,7,0)- FamilyI (FamilyD TypeFam _ bndrs _) _- -> withinFirstArgs bndrs #else- TyConI (FamilyD TypeFam _ bndrs _)+ FamilyI (FamilyD TypeFam _ bndrs _) _ -> withinFirstArgs bndrs #endif #if MIN_VERSION_template_haskell(2,11,0) FamilyI (ClosedTypeFamilyD (TypeFamilyHead _ bndrs _ _) _) _ -> withinFirstArgs bndrs-#elif MIN_VERSION_template_haskell(2,9,0)+#else FamilyI (ClosedTypeFamilyD _ bndrs _ _) _ -> withinFirstArgs bndrs #endif@@ -1542,10 +1530,7 @@ where go :: Type -> [Name] -> Bool go (AppT t1 t2) names = go t1 names || go t2 names- go (SigT t _k) names = go t names-#if MIN_VERSION_template_haskell(2,8,0)- || go _k names-#endif+ go (SigT t k) names = go t names || go k names go (VarT n) names = n `elem` names go _ _ = False @@ -1605,15 +1590,6 @@ uncurryTy (SigT t _) = uncurryTy t uncurryTy (ForallT _ _ t) = uncurryTy t uncurryTy t = t :| []---- | Like uncurryType, except on a kind level.-uncurryKind :: Kind -> NonEmpty Kind-#if MIN_VERSION_template_haskell(2,8,0)-uncurryKind = uncurryTy-#else-uncurryKind (ArrowK k1 k2) = k1 <| uncurryKind k2-uncurryKind k = k :| []-#endif createKindChain :: Int -> Kind createKindChain = go starK
src/TextShow/Text/Read.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-|@@ -16,7 +15,7 @@ -} module TextShow.Text.Read () where -import Text.Read.Lex (Lexeme)+import Text.Read.Lex (Lexeme, Number) import TextShow.Data.Char () import TextShow.Data.Integral ()@@ -24,16 +23,9 @@ import TextShow.Data.Maybe () import TextShow.Data.Ratio () import TextShow.TH.Internal (deriveTextShow)-#if MIN_VERSION_base(4,6,0)-import TextShow.TH.Names (numberTypeName)-#endif -#if MIN_VERSION_base(4,6,0)--- | Only available with @base-4.6.0.0@ or later.------ /Since: 2/-$(deriveTextShow numberTypeName)-#endif+-- | /Since: 2/+$(deriveTextShow ''Number) -- | /Since: 2/ $(deriveTextShow ''Lexeme)
src/TextShow/Utils.hs view
@@ -12,8 +12,7 @@ Miscellaneous utility functions. -} module TextShow.Utils (- coerce- , i2d+ i2d , isInfixDataCon , isSymVar , isTupleString@@ -34,26 +33,10 @@ import Prelude () import Prelude.Compat hiding (length) -#if __GLASGOW_HASKELL__ >= 708-import qualified Data.Coerce as C (Coercible, coerce)-#else-import Unsafe.Coerce (unsafeCoerce)-#endif- #if defined(MIN_VERSION_ghc_boot_th) import GHC.Lexeme (startsVarSym) #else import Data.Char (isSymbol, ord)-#endif---- | On GHC 7.8 and later, this is 'C.coerce' from "Data.Coerce". Otherwise, it's--- 'unsafeCoerce'.-#if __GLASGOW_HASKELL__ >= 708-coerce :: C.Coercible a b => a -> b-coerce = C.coerce-#else-coerce :: a -> b-coerce = unsafeCoerce #endif -- | Unsafe conversion for decimal digits.
tests/Derived/DataFamilies.hs view
@@ -1,18 +1,15 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE PolyKinds #-}-#endif--#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710+#if __GLASGOW_HASKELL__ < 710 -- Starting with GHC 7.10, NullaryTypeClasses was deprecated in favor of -- MultiParamTypeClasses, which is already enabled {-# LANGUAGE NullaryTypeClasses #-}@@ -30,13 +27,9 @@ -} module Derived.DataFamilies ( NotAllShow(..)-#if __GLASGOW_HASKELL__ >= 706 , KindDistinguished(..)-#endif-#if __GLASGOW_HASKELL__ >= 708 , NullaryClass(..) , NullaryData(..)-#endif ) where #include "generic.h"@@ -45,11 +38,9 @@ import qualified Generics.Deriving.TH as Generics #endif -#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic)-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) import GHC.Generics (Generic1)-# endif #endif import Instances.Utils.GenericArbitrary (genericArbitrary)@@ -74,11 +65,9 @@ data instance NotAllShow Int b c d = NASShow1 c b | NASShow2 d deriving ( Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif ) @@ -101,29 +90,24 @@ $(Generics.deriveRepresentable1 'NASShow2) #endif -#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveRepresentable0 'NASShow1)-#endif- ------------------------------------------------------------------------------- -#if __GLASGOW_HASKELL__ >= 706 data family KindDistinguished (x :: k) (y :: *) (z :: *) :: * data instance KindDistinguished (a :: ()) b c = KindDistinguishedUnit b c deriving ( Show , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif+#endif ) data instance KindDistinguished (a :: Bool) b c = KindDistinguishedBool b c deriving ( Show , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif+#endif ) instance (Arbitrary b, Arbitrary c)@@ -134,17 +118,17 @@ => Arbitrary (KindDistinguished (a :: Bool) b c) where arbitrary = genericArbitrary -# if !defined(NEW_FUNCTOR_CLASSES)+#if !defined(NEW_FUNCTOR_CLASSES) $(deriveShow1 'KindDistinguishedUnit) $(deriveShow1 'KindDistinguishedBool)-# else+#else $(deriveShow1 'KindDistinguishedUnit) $(deriveShow2 'KindDistinguishedUnit) $(deriveShow1 'KindDistinguishedBool) $(deriveShow2 'KindDistinguishedBool)-# endif+#endif $(deriveTextShow 'KindDistinguishedUnit) $(deriveTextShow1 'KindDistinguishedUnit)@@ -154,15 +138,13 @@ $(deriveTextShow1 'KindDistinguishedBool) $(deriveTextShow2 'KindDistinguishedBool) -# if !defined(__LANGUAGE_DERIVE_GENERIC1__)+#if !defined(__LANGUAGE_DERIVE_GENERIC1__) $(Generics.deriveAll1 'KindDistinguishedUnit) $(Generics.deriveAll1 'KindDistinguishedBool)-# endif #endif ------------------------------------------------------------------------------- -#if __GLASGOW_HASKELL__ >= 708 class NullaryClass where data NullaryData :: * @@ -171,4 +153,3 @@ deriving (Arbitrary, Show, Generic) $(deriveTextShow 'NullaryCon)-#endif
tests/Derived/Infix.hs view
@@ -1,14 +1,11 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-#endif- {-| Module: Derived.Infix Copyright: (C) 2014-2017 Ryan Scott@@ -32,10 +29,7 @@ import qualified Generics.Deriving.TH as Generics #endif -import GHC.Generics (Generic)-#if __GLASGOW_HASKELL__ >= 706-import GHC.Generics (Generic1)-#endif+import GHC.Generics (Generic, Generic1) import Instances.Utils.GenericArbitrary (genericArbitrary) @@ -63,9 +57,7 @@ | TyConFakeInfix a b deriving ( Show , Generic-#if __GLASGOW_HASKELL__ >= 706 , Generic1-#endif ) -------------------------------------------------------------------------------@@ -77,10 +69,8 @@ (:...) :: g -> h -> Int -> TyConGADT g h (:....) :: { tcg1 :: i, tcg2 :: j } -> TyConGADT i j deriving ( Show-#if __GLASGOW_HASKELL__ >= 706 , Generic , Generic1-#endif ) -------------------------------------------------------------------------------@@ -96,11 +86,9 @@ | a `TyFamilyPlain` b | TyFamilyFakeInfix a b deriving ( Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif ) @@ -115,11 +103,9 @@ (:***) :: g -> h -> Int -> TyFamilyGADT g h (:****) :: { tfg1 :: i, tfg2 :: j } -> TyFamilyGADT i j deriving ( Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif ) @@ -154,12 +140,6 @@ $(deriveTextShow1 ''TyConGADT) $(deriveTextShow2 ''TyConGADT) -#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveMeta ''TyConPlain)-$(Generics.deriveRepresentable1 ''TyConPlain)-$(Generics.deriveAll0And1 ''TyConGADT)-#endif- #if !defined(NEW_FUNCTOR_CLASSES) $(deriveShow1 '(:#:)) @@ -185,9 +165,4 @@ $(Generics.deriveRepresentable1 '(:$:)) $(Generics.deriveMeta '(:*)) $(Generics.deriveRepresentable1 '(:**))-#endif--#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveRepresentable0 'TyFamilyPlain)-$(Generics.deriveRepresentable0 '(:***)) #endif
tests/Derived/MagicHash.hs view
@@ -1,13 +1,10 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-#endif- {-| Module: Derived.MagicHash Copyright: (C) 2014-2017 Ryan Scott@@ -72,6 +69,10 @@ , tcInt16# :: Int16# , tcWord8# :: Word8# , tcWord16# :: Word16#+# if MIN_VERSION_base(4,16,0)+ , tcInt32# :: Int32#+ , tcWord32# :: Word32#+# endif } deriving Show #endif @@ -104,6 +105,10 @@ , tfInt16# :: Int16# , tfWord8# :: Word8# , tfWord16# :: Word16#+# if MIN_VERSION_base(4,16,0)+ , tfInt32# :: Int32#+ , tfWord32# :: Word32#+# endif } deriving Show #endif @@ -124,8 +129,15 @@ I# i2 <- arbitrary W# w1 <- arbitrary W# w2 <- arbitrary+# if MIN_VERSION_base(4,16,0)+ I# i3 <- arbitrary+ W# w3 <- arbitrary+# endif pure $ TyCon'# a b (intToInt8Compat# i1) (intToInt16Compat# i2) (wordToWord8Compat# w1) (wordToWord16Compat# w2)+# if MIN_VERSION_base(4,16,0)+ (intToInt32# i3) (wordToWord32# w3)+# endif instance (Arbitrary a, Arbitrary b) => Arbitrary (TyFamily'# a b) where arbitrary = do@@ -135,8 +147,15 @@ I# i2 <- arbitrary W# w1 <- arbitrary W# w2 <- arbitrary+# if MIN_VERSION_base(4,16,0)+ I# i3 <- arbitrary+ W# w3 <- arbitrary+# endif pure $ TyFamily'# a b (intToInt8Compat# i1) (intToInt16Compat# i2) (wordToWord8Compat# w1) (wordToWord16Compat# w2)+# if MIN_VERSION_base(4,16,0)+ (intToInt32# i3) (wordToWord32# w3)+# endif # if MIN_VERSION_base(4,16,0) intToInt8Compat# :: Int# -> Int8#
tests/Derived/PolyKinds.hs view
@@ -1,19 +1,16 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE PolyKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|@@ -38,6 +35,7 @@ #include "generic.h" import Data.Functor.Classes (Show1(..))+import Data.Orphans () import Generics.Deriving.Base #if !defined(__LANGUAGE_DERIVE_GENERIC1__)@@ -103,30 +101,17 @@ ------------------------------------------------------------------------------- data family TyFamilyCompose-#if __GLASGOW_HASKELL__ >= 706 (t :: k1 -> k2 -> *) (u :: k3 -> k4 -> k1) (v :: k3 -> k4 -> k2) (w :: k5 -> k3) (x :: k5 -> k4) (y :: k5)- (z :: k5)-#else- (t :: * -> * -> *)- (u :: * -> * -> *)- (v :: * -> * -> *)- (w :: * -> *)- (x :: * -> *)- (y :: *)- (z :: *)-#endif- :: *+ (z :: k5) :: * newtype instance TyFamilyCompose f g h j k a b = TyFamilyCompose (f (g (j a) (k a)) (h (j a) (k b)))-#if __GLASGOW_HASKELL__ >= 706 deriving Generic-#endif deriving instance Arbitrary (f (g (j a) (k a)) (h (j a) (k b))) => Arbitrary (TyFamilyCompose f g h j k a b)@@ -142,55 +127,35 @@ ------------------------------------------------------------------------------- -data family TyFamilyProxy-#if __GLASGOW_HASKELL__ >= 706- (x :: k1) (y :: k2)-#else- (x :: *) (y :: *)-#endif- :: *+data family TyFamilyProxy (x :: k1) (y :: k2) :: * newtype instance TyFamilyProxy a b where TyFamilyProxy :: () -> TyFamilyProxy a b deriving ( Arbitrary , Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif ) ------------------------------------------------------------------------------- data family TyFamilyReallyHighKinds-#if __GLASGOW_HASKELL__ >= 706 (g :: k1 -> k2 -> k3 -> k4 -> k5 -> *) (v :: k1) (w :: k2) (x :: k3) (y :: k4)- (z :: k5)-#else- (g :: * -> * -> * -> * -> * -> *)- (v :: *)- (w :: *)- (x :: *)- (y :: *)- (z :: *)-#endif- :: *+ (z :: k5) :: * newtype instance TyFamilyReallyHighKinds f a b c d e = TyFamilyReallyHighKinds (f a b c d e) deriving ( Arbitrary , Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif ) @@ -335,10 +300,4 @@ $(Generics.deriveRepresentable1 'TyFamilyProxy) $(Generics.deriveMeta 'TyFamilyReallyHighKinds) $(Generics.deriveRepresentable1 'TyFamilyReallyHighKinds)-#endif--#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveRepresentable0 'TyFamilyCompose)-$(Generics.deriveRepresentable0 'TyFamilyProxy)-$(Generics.deriveRepresentable0 'TyFamilyReallyHighKinds) #endif
tests/Derived/Records.hs view
@@ -1,12 +1,9 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} -#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-#endif- {-| Module: Derived.Records Copyright: (C) 2014-2017 Ryan Scott@@ -25,10 +22,7 @@ import qualified Generics.Deriving.TH as Generics #endif -import GHC.Generics (Generic)-#if __GLASGOW_HASKELL__ >= 706-import GHC.Generics (Generic1)-#endif+import GHC.Generics (Generic, Generic1) import Instances.Utils.GenericArbitrary (genericArbitrary) @@ -51,9 +45,7 @@ | (:@:) { tc3 :: b, (##) :: a } deriving ( Show , Generic-#if __GLASGOW_HASKELL__ >= 706 , Generic1-#endif ) -------------------------------------------------------------------------------@@ -64,11 +56,9 @@ data instance TyFamily a b = TyFamilyPrefix { tf1 :: a, tf2 :: b } | (:!:) { tf3 :: b, (###) :: a } deriving ( Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-# if defined(__LANGUAGE_DERIVE_GENERIC1__)+#if defined(__LANGUAGE_DERIVE_GENERIC1__) , Generic1-# endif #endif ) @@ -91,11 +81,6 @@ $(deriveTextShow1 ''TyCon) $(deriveTextShow2 ''TyCon) -#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveMeta ''TyCon)-$(Generics.deriveRepresentable1 ''TyCon)-#endif- #if !defined(NEW_FUNCTOR_CLASSES) $(deriveShow1 'TyFamilyPrefix) #else@@ -110,8 +95,4 @@ #if !defined(__LANGUAGE_DERIVE_GENERIC1__) $(Generics.deriveMeta 'TyFamilyPrefix) $(Generics.deriveRepresentable1 '(:!:))-#endif--#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveRepresentable0 'TyFamilyPrefix) #endif
tests/Derived/TypeFamilies.hs view
@@ -1,4 +1,4 @@--- {-# LANGUAGE CPP #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-}@@ -20,12 +20,10 @@ import Test.QuickCheck (Arbitrary) -{- import Text.Show.Deriving (deriveShow1) #if defined(NEW_FUNCTOR_CLASSES) import Text.Show.Deriving (deriveShow2) #endif--} import TextShow.TH (deriveTextShow, deriveTextShow1, deriveTextShow2) @@ -43,16 +41,12 @@ ------------------------------------------------------------------------------- -{--TODO: Define these once we depend on deriving-compat-0.5.8 as the minimum- $(deriveShow1 ''TyConOverSat) $(deriveShow1 'TyFamilyOverSat) #if defined(NEW_FUNCTOR_CLASSES) $(deriveShow2 ''TyConOverSat) $(deriveShow2 'TyFamilyOverSat) #endif--} $(deriveTextShow ''TyConOverSat) $(deriveTextShow1 ''TyConOverSat)@@ -61,8 +55,3 @@ $(deriveTextShow 'TyFamilyOverSat) $(deriveTextShow1 'TyFamilyOverSat) $(deriveTextShow2 'TyFamilyOverSat)--{--TODO: Define Generic(1) instances once we depend on generic-deriving-1.13.2-as the minimum--}
tests/Derived/TypeSynonyms.hs view
@@ -1,13 +1,9 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-}--#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|@@ -70,14 +66,11 @@ ) deriving ( Arbitrary , Show-#if __GLASGOW_HASKELL__ >= 706 , Generic-#endif ) ------------------------------------------------------------------------------- --- TODO: Consider backporting these instances somewhere #if !(MIN_VERSION_base(4,9,0)) $(deriveShow1 ''(,,,)) # if defined(NEW_FUNCTOR_CLASSES)@@ -110,7 +103,3 @@ $(Generics.deriveMeta 'TyFamily) $(Generics.deriveRepresentable1 'TyFamily)--#if __GLASGOW_HASKELL__ < 706-$(Generics.deriveRepresentable0 'TyFamily)-#endif
tests/Instances/Control/Exception.hs view
@@ -55,10 +55,8 @@ instance Arbitrary AssertionFailed where arbitrary = genericArbitrary -#if MIN_VERSION_base(4,7,0) instance Arbitrary SomeAsyncException where arbitrary = SomeAsyncException <$> (arbitrary :: Gen AsyncException)-#endif deriving instance Bounded AsyncException deriving instance Enum AsyncException
tests/Instances/Data/OldTypeable.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} -#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -19,7 +19,7 @@ -} module Instances.Data.OldTypeable () where -#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) import Data.OldTypeable.Internal (TyCon(..), TypeRep(..)) import GHC.Generics (Generic)
tests/Instances/Data/Tuple.hs view
@@ -12,7 +12,7 @@ -} module Instances.Data.Tuple () where -import Data.Orphans ()+import Generics.Deriving.Instances () import Instances.Utils.GenericArbitrary (genericArbitrary) import Test.QuickCheck (Arbitrary(..))
tests/Instances/Data/Type/Coercion.hs view
@@ -1,9 +1,5 @@ {-# LANGUAGE CPP #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|@@ -18,7 +14,6 @@ -} module Instances.Data.Type.Coercion () where -#if MIN_VERSION_base(4,7,0) import Data.Coerce (Coercible) import Data.Type.Coercion (Coercion(..)) @@ -26,4 +21,3 @@ instance Coercible a b => Arbitrary (Coercion a b) where arbitrary = arbitraryBoundedEnum-#endif
tests/Instances/Data/Type/Equality.hs view
@@ -1,11 +1,7 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}--#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE PolyKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|
tests/Instances/Data/Typeable.hs view
@@ -1,12 +1,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-}--#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE PolyKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|
tests/Instances/GHC/TypeLits.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0)) {-# LANGUAGE PolyKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|@@ -18,20 +13,13 @@ -} module Instances.GHC.TypeLits () where -#if MIN_VERSION_base(4,6,0) import GHC.TypeLits import Prelude () import Prelude.Compat -import Test.QuickCheck (Arbitrary(..))--# if MIN_VERSION_base(4,7,0)-import Test.QuickCheck (getNonNegative)-# endif-#endif+import Test.QuickCheck (Arbitrary(..), getNonNegative) -#if MIN_VERSION_base(4,7,0) instance Arbitrary SomeNat where arbitrary = do nat <- getNonNegative <$> arbitrary@@ -41,13 +29,3 @@ instance Arbitrary SomeSymbol where arbitrary = someSymbolVal <$> arbitrary-#elif MIN_VERSION_base(4,6,0)-instance SingI a => Arbitrary (Sing a) where- arbitrary = pure sing--instance SingI n => Arbitrary (IsZero n) where- arbitrary = pure $ isZero sing--instance SingI n => Arbitrary (IsEven n) where- arbitrary = pure $ isEven sing-#endif
tests/Instances/Generic.hs view
@@ -20,12 +20,7 @@ -} module Instances.Generic () where -import GHC.Generics (Generic)-#if __GLASGOW_HASKELL__ >= 706-import GHC.Generics (Generic1)-#else-import Generics.Deriving.TH (deriveAll1)-#endif+import GHC.Generics (Generic, Generic1) import Instances.Data.Text () import Instances.Utils (GenericExample(..))@@ -50,11 +45,7 @@ arbitrary = genericArbitrary deriving instance Generic (GenericExample a)-#if __GLASGOW_HASKELL__ >= 706 deriving instance Generic1 GenericExample-#else-$(deriveAll1 ''GenericExample)-#endif #if __GLASGOW_HASKELL__ >= 806 deriving via FromGeneric (GenericExample a)
tests/Instances/Text/Read.hs view
@@ -1,13 +1,8 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeSynonymInstances #-}--#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE DataKinds #-}-#endif- {-# OPTIONS_GHC -fno-warn-orphans #-} {-|@@ -26,28 +21,13 @@ import Instances.Utils.GenericArbitrary (genericArbitrary) import Test.QuickCheck (Arbitrary(..)) import Text.Read (Lexeme(..))--#if MIN_VERSION_base(4,6,0)-import Language.Haskell.TH.Lib (conT)-import TextShow.TH.Names (numberTypeName)-#endif+import Text.Read.Lex (Number) $(Generics.deriveAll0 ''Lexeme)-#if MIN_VERSION_base(4,6,0)-$(Generics.deriveAll0 numberTypeName)-#endif+$(Generics.deriveAll0 ''Number) instance Arbitrary Lexeme where arbitrary = genericArbitrary -#if MIN_VERSION_base(4,6,0)--- NB: Don't attempt to define------ type Number' = $(conT numberTypeName)------ here. Sadly, due to a bizarre GHC 7.6 bug, it'll think it's a recursive--- type synonym and reject it.--instance Arbitrary $(conT numberTypeName) where+instance Arbitrary Number where arbitrary = genericArbitrary-#endif
tests/Spec/Control/ExceptionSpec.hs view
@@ -36,10 +36,8 @@ matchesTextShowSpec (Proxy :: Proxy ArrayException) describe "AssertionFailed" $ matchesTextShowSpec (Proxy :: Proxy AssertionFailed)-#if MIN_VERSION_base(4,7,0) describe "SomeAsyncException" $ matchesTextShowSpec (Proxy :: Proxy SomeAsyncException)-#endif describe "AsyncException" $ matchesTextShowSpec (Proxy :: Proxy AsyncException) describe "NonTermination" $
tests/Spec/Data/OldTypeableSpec.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} -#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} #endif @@ -23,7 +23,7 @@ import Test.Hspec (Spec, hspec, parallel) -#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) import Data.OldTypeable (TyCon, TypeRep) import Data.Proxy.Compat (Proxy(..)) @@ -37,7 +37,7 @@ spec :: Spec spec = parallel $ do-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,8,0)) describe "TypeRep" $ matchesTextShowSpec (Proxy :: Proxy TypeRep) describe "TyCon" $
tests/Spec/Data/TupleSpec.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {-| Module: Spec.Data.TupleSpec Copyright: (C) 2014-2017 Ryan Scott@@ -12,10 +14,14 @@ import Data.Proxy.Compat (Proxy(..)) import Generics.Deriving.Instances ()+#if MIN_VERSION_ghc_prim(0,7,0)+import GHC.Tuple (Solo)+#endif import Instances.Data.Tuple () import Spec.Utils (matchesTextShowSpec, matchesTextShow1Spec, genericTextShowSpec, genericTextShow1Spec) import Test.Hspec (Spec, describe, hspec, parallel)+import Test.QuickCheck.Instances () main :: IO () main = hspec spec@@ -79,3 +85,10 @@ matchesTextShowSpec (Proxy :: Proxy (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)) describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do matchesTextShowSpec (Proxy :: Proxy (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int))+#if MIN_VERSION_ghc_prim(0,7,0)+ describe "Solo Int" $ do+ let p :: Proxy (Solo Int)+ p = Proxy+ matchesTextShowSpec p+ matchesTextShow1Spec p+#endif
tests/Spec/Data/Type/CoercionSpec.hs view
@@ -12,31 +12,23 @@ -} module Spec.Data.Type.CoercionSpec (main, spec) where +import Data.Monoid (All(..))+import Data.Proxy.Compat (Proxy(..))+import Data.Type.Coercion (Coercion)+ import Instances.Data.Type.Coercion () import Prelude () import Prelude.Compat -import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,7,0)-import Data.Monoid (All(..))-import Data.Proxy.Compat (Proxy(..))-import Data.Type.Coercion (Coercion)- import Spec.Utils (matchesTextShowSpec) -import Test.Hspec (describe)-#endif+import Test.Hspec (Spec, describe, hspec, parallel) main :: IO () main = hspec spec spec :: Spec spec = parallel $-#if MIN_VERSION_base(4,7,0) describe "Coercion All Bool" $ matchesTextShowSpec (Proxy :: Proxy (Coercion All Bool))-#else- pure ()-#endif
tests/Spec/Data/TypeableSpec.hs view
@@ -1,8 +1,5 @@ {-# LANGUAGE CPP #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE DataKinds #-}-#endif {-| Module: Spec.Data.TypeableSpec
tests/Spec/Derived/DataFamiliesSpec.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE DataKinds #-}-#endif {-| Module: Spec.Derived.DataFamiliesSpec@@ -18,24 +14,16 @@ import Data.Proxy.Compat (Proxy(..)) -import Derived.DataFamilies (NotAllShow)+import Derived.DataFamilies (NotAllShow, KindDistinguished, NullaryData) import Prelude () import Prelude.Compat -import Spec.Utils (matchesTextShow1Spec, genericTextShowSpec, genericTextShow1Spec)+import Spec.Utils ( matchesTextShowSpec, matchesTextShow1Spec+ , genericTextShowSpec, genericTextShow1Spec ) import Test.Hspec (Spec, describe, hspec, parallel) -#if __GLASGOW_HASKELL__ >= 706-import Derived.DataFamilies (KindDistinguished)-#endif--#if __GLASGOW_HASKELL__ >= 708-import Derived.DataFamilies (NullaryData)-import Spec.Utils (matchesTextShowSpec)-#endif- main :: IO () main = hspec spec @@ -47,7 +35,6 @@ matchesTextShow1Spec p genericTextShowSpec p genericTextShow1Spec p-#if __GLASGOW_HASKELL__ >= 706 describe "KindDistinguished '() Int Int" $ do let p :: Proxy (KindDistinguished '() Int Int) p = Proxy@@ -60,11 +47,8 @@ matchesTextShow1Spec p genericTextShowSpec p genericTextShow1Spec p-#endif-#if __GLASGOW_HASKELL__ >= 708 describe "NullaryData" $ do let p :: Proxy NullaryData p = Proxy matchesTextShowSpec p genericTextShowSpec p-#endif
tests/Spec/Derived/TypeFamiliesSpec.hs view
@@ -10,33 +10,23 @@ -} module Spec.Derived.TypeFamiliesSpec (main, spec) where -{- import Data.Proxy.Compat (Proxy(..)) import Derived.TypeFamilies--} import Prelude () import Prelude.Compat -{- import Spec.Utils (matchesTextShow1Spec) import Test.Hspec (Spec, describe, hspec, parallel)--}-import Test.Hspec (Spec, hspec) main :: IO () main = hspec spec spec :: Spec-spec = pure ()-{--TODO: Uncomment once we depend on deriving-compat-0.5.8 as the minimum- spec = parallel $ do describe "TyConOverSat Int Int" $ matchesTextShow1Spec (Proxy :: Proxy (TyConOverSat Int Int)) describe "TyFamilyOverSat Int Int" $ matchesTextShow1Spec (Proxy :: Proxy (TyFamilyOverSat Int Int))--}
tests/Spec/GHC/GenericsSpec.hs view
@@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-}-{-# LANGUAGE TypeOperators #-}--#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE DataKinds #-}-#endif+{-# LANGUAGE TypeOperators #-} {-| Module: Spec.GHC.GenericsSpec
tests/Spec/GHC/TypeLitsSpec.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0)) {-# LANGUAGE DataKinds #-}-#endif {-| Module: Spec.GHC.TypeLitsSpec@@ -16,45 +12,25 @@ -} module Spec.GHC.TypeLitsSpec (main, spec) where +import Data.Proxy.Compat (Proxy(..))++import GHC.TypeLits+ import Instances.GHC.TypeLits () import Prelude () import Prelude.Compat -import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,6,0)-import Data.Proxy.Compat (Proxy(..))-import GHC.TypeLits import Spec.Utils (matchesTextShowSpec)-import Test.Hspec (describe)-#endif +import Test.Hspec (Spec, describe, hspec, parallel)+ main :: IO () main = hspec spec spec :: Spec spec = parallel $ do-#if MIN_VERSION_base(4,7,0) describe "SomeNat" $ matchesTextShowSpec (Proxy :: Proxy SomeNat) describe "SomeSymbol" $ matchesTextShowSpec (Proxy :: Proxy SomeSymbol)-#elif MIN_VERSION_base(4,6,0)- describe "IsEven 0" $- matchesTextShowSpec (Proxy :: Proxy (IsEven 0))- describe "IsEven 1" $- matchesTextShowSpec (Proxy :: Proxy (IsEven 1))- describe "IsEven 2" $- matchesTextShowSpec (Proxy :: Proxy (IsEven 2))- describe "IsZero 0" $- matchesTextShowSpec (Proxy :: Proxy (IsZero 0))- describe "IsZero 1" $- matchesTextShowSpec (Proxy :: Proxy (IsZero 1))- describe "Sing 0" $- matchesTextShowSpec (Proxy :: Proxy (Sing 0))- describe "Sing \"a\"" $- matchesTextShowSpec (Proxy :: Proxy (Sing "a"))-#else- pure ()-#endif
tests/Spec/Text/ReadSpec.hs view
@@ -1,6 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE TemplateHaskell #-}- {-| Module: Spec.Text.ReadSpec Copyright: (C) 2014-2017 Ryan Scott@@ -18,11 +15,7 @@ import Spec.Utils (matchesTextShowSpec) import Test.Hspec (Spec, describe, hspec, parallel) import Text.Read (Lexeme)--#if MIN_VERSION_base(4,6,0)-import Language.Haskell.TH.Lib (conT)-import TextShow.TH.Names (numberTypeName)-#endif+import Text.Read.Lex (Number) main :: IO () main = hspec spec@@ -31,7 +24,5 @@ spec = parallel $ do describe "Lexeme" $ matchesTextShowSpec (Proxy :: Proxy Lexeme)-#if MIN_VERSION_base(4,6,0) describe "Number" $- matchesTextShowSpec (Proxy :: Proxy $(conT numberTypeName))-#endif+ matchesTextShowSpec (Proxy :: Proxy Number)
text-show.cabal view
@@ -1,5 +1,5 @@ name: text-show-version: 3.9.2+version: 3.9.3 synopsis: Efficient conversion of values into Text description: @text-show@ offers a replacement for the @Show@ typeclass intended for use with @Text@ instead of @String@s. This package was created@@ -43,9 +43,7 @@ copyright: (C) 2014-2017 Ryan Scott category: Text build-type: Simple-tested-with: GHC == 7.4.2- , GHC == 7.6.3- , GHC == 7.8.4+tested-with: GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2@@ -161,24 +159,24 @@ , bytestring >= 0.9 && < 0.12 , bytestring-builder , containers >= 0.1 && < 0.7- , generic-deriving >= 1.11 && < 2+ , generic-deriving >= 1.14.1 && < 2 , ghc-prim , integer-gmp , text >= 0.11.1 && < 1.3- , th-abstraction >= 0.3 && < 0.5+ , th-abstraction >= 0.4 && < 0.5 , th-lift >= 0.7.6 && < 1 if flag(base-4-9)- build-depends: base >= 4.9 && < 4.16+ build-depends: base >= 4.9 && < 4.17 cpp-options: "-DNEW_FUNCTOR_CLASSES" else- build-depends: base >= 4.5 && < 4.9+ build-depends: base >= 4.7 && < 4.9 if flag(template-haskell-2-11)- build-depends: template-haskell >= 2.11 && < 2.18- , ghc-boot-th >= 8.0 && < 9.1+ build-depends: template-haskell >= 2.11 && < 2.19+ , ghc-boot-th >= 8.0 && < 9.3 else- build-depends: template-haskell >= 2.5 && < 2.11+ build-depends: template-haskell >= 2.9 && < 2.11 if flag(new-functor-classes) build-depends: transformers (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)@@ -344,23 +342,23 @@ , base-orphans >= 0.8.5 && < 0.9 , bytestring >= 0.9 && < 0.12 , bytestring-builder- , deriving-compat >= 0.5.6 && < 1+ , deriving-compat >= 0.6 && < 1 , generic-deriving >= 1.14.1 && < 2 , ghc-prim , hspec >= 2 && < 3 , QuickCheck >= 2.12 && < 2.15- , quickcheck-instances >= 0.3.18 && < 0.4- , template-haskell >= 2.5 && < 2.18+ , quickcheck-instances >= 0.3.26 && < 0.4+ , template-haskell >= 2.9 && < 2.19 , text >= 0.11.1 && < 1.3 , text-show , transformers-compat >= 0.5 && < 1 build-tool-depends: hspec-discover:hspec-discover if flag(base-4-9)- build-depends: base >= 4.9 && < 4.16+ build-depends: base >= 4.9 && < 4.17 cpp-options: "-DNEW_FUNCTOR_CLASSES" else- build-depends: base >= 4.5 && < 4.9+ build-depends: base >= 4.7 && < 4.9 if flag(new-functor-classes) build-depends: transformers (>= 0.2.1 && < 0.4) || (>= 0.5 && < 0.6)@@ -380,7 +378,7 @@ benchmark bench type: exitcode-stdio-1.0 main-is: Bench.hs- build-depends: base >= 4.5 && < 4.16+ build-depends: base >= 4.5 && < 4.17 , criterion >= 1.1.4 && < 2 , deepseq >= 1.3 && < 2 , ghc-prim