base-compat-batteries 0.10.3 → 0.10.4
raw patch · 5 files changed
+89/−29 lines, 5 filesdep ~base-compatPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base-compat
API changes (from Hackage documentation)
- Type.Reflection.Compat: withTypeable :: () => TypeRep a -> Typeable a -> r -> r
Files
- CHANGES.markdown +7/−0
- base-compat-batteries.cabal +6/−2
- src/Type/Reflection/Compat.hs +3/−27
- test/SafeHaskellSpec.hs +65/−0
- test/TestHspecTrustworthy.hs +8/−0
CHANGES.markdown view
@@ -1,3 +1,10 @@+## Changes in 0.10.4 [2018.07.03]+ - Add a `SafeHaskellSpec` test which ensures that certain modules (such as+ `Prelude.Compat`) can be imported in the presence of `Safe`.+ - This coincides with the `base-compat-0.10.4` release. Refer to the+ [`base-compat` changelog](https://github.com/haskell-compat/base-compat/blob/master/base-compat/CHANGES.markdown#changes-in-0104-20180703)+ for more details.+ ## Changes in 0.10.3 [2018.07.02] - This coincides with the `base-compat-0.10.3` release. Refer to the [`base-compat` changelog](https://github.com/haskell-compat/base-compat/blob/master/base-compat/CHANGES.markdown#changes-in-0103-20180702)
base-compat-batteries.cabal view
@@ -1,5 +1,5 @@ name: base-compat-batteries-version: 0.10.3+version: 0.10.4 license: MIT license-file: LICENSE copyright: (c) 2012-2018 Simon Hengel,@@ -56,7 +56,7 @@ -Wall build-depends: base >= 4.3 && < 5,- base-compat == 0.10.3+ base-compat == 0.10.4 if !impl(ghc >= 7.8) build-depends: tagged >= 0.8.5 && < 0.9@@ -225,6 +225,10 @@ Prelude.CompatSpec System.Environment.CompatSpec Text.Read.CompatSpec++ -- Other tests+ SafeHaskellSpec+ TestHspecTrustworthy build-depends: base >= 4.3 && < 5 , base-compat-batteries
src/Type/Reflection/Compat.hs view
@@ -1,34 +1,10 @@-{-# LANGUAGE CPP, NoImplicitPrelude #-}-#if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,11,0))-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeInType #-}-#endif+{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} module Type.Reflection.Compat ( #if MIN_VERSION_base(4,10,0) module Base-, withTypeable #endif ) where -#if MIN_VERSION_base(4,11,0)-import Type.Reflection as Base-#elif MIN_VERSION_base(4,10,0)-import Type.Reflection as Base hiding (withTypeable)-#endif--#if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,11,0))-import GHC.Exts (TYPE)-import Type.Reflection (Typeable, TypeRep)-import Unsafe.Coerce (unsafeCoerce)---- | Use a 'TypeRep' as 'Typeable' evidence.-withTypeable :: forall (a :: k) (r :: TYPE rep). ()- => TypeRep a -> (Typeable a => r) -> r-withTypeable rep k = unsafeCoerce k' rep- where k' :: Gift a r- k' = Gift k---- | A helper to satisfy the type checker in 'withTypeable'.-newtype Gift a (r :: TYPE rep) = Gift (Typeable a => r)+#if MIN_VERSION_base(4,10,0)+import "base-compat" Type.Reflection.Compat as Base #endif
+ test/SafeHaskellSpec.hs view
@@ -0,0 +1,65 @@+{-# LANGUAGE CPP, NoImplicitPrelude #-}+#if __GLASGOW_HASKELL__ >= 704+{-# LANGUAGE Safe #-}+#endif+module SafeHaskellSpec (main, spec) where++import TestHspecTrustworthy++-- The following modules should not be Unsafe (#56):+import Control.Concurrent.Compat ()+import Control.Concurrent.MVar.Compat ()+import Control.Exception.Compat ()+import Control.Monad.Compat ()+import Control.Monad.Fail.Compat ()+import Control.Monad.IO.Class.Compat ()+import Data.Bifoldable.Compat ()+import Data.Bifunctor.Compat ()+import Data.Bitraversable.Compat ()+import Data.Bits.Compat ()+import Data.Bool.Compat ()+import Data.Complex.Compat ()+import Data.Either.Compat ()+import Data.Foldable.Compat ()+import Data.Function.Compat ()+import Data.Functor.Compat ()+import Data.Functor.Compose.Compat ()+import Data.Functor.Const.Compat ()+import Data.Functor.Contravariant.Compat ()+import Data.Functor.Identity.Compat ()+import Data.Functor.Product.Compat ()+import Data.Functor.Sum.Compat ()+import Data.IORef.Compat ()+import Data.List.Compat ()+import Data.List.NonEmpty.Compat ()+import Data.Monoid.Compat ()+import Data.Proxy.Compat ()+import Data.Ratio.Compat ()+import Data.Semigroup.Compat ()+import Data.STRef.Compat ()+import Data.String.Compat ()+import Data.Type.Coercion.Compat ()+import Data.Version.Compat ()+import Data.Void.Compat ()+import Data.Word.Compat ()+import Foreign.Compat ()+import Foreign.ForeignPtr.Compat ()+import Foreign.ForeignPtr.Safe.Compat ()+import Foreign.Marshal.Alloc.Compat ()+import Foreign.Marshal.Array.Compat ()+import Foreign.Marshal.Compat ()+import Foreign.Marshal.Safe.Compat ()+import Foreign.Marshal.Utils.Compat ()+import Numeric.Compat ()+import Numeric.Natural.Compat ()+import Prelude.Compat+import System.Environment.Compat ()+import System.Exit.Compat ()+import Text.Read.Compat ()+import Type.Reflection.Compat ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = pure ()
+ test/TestHspecTrustworthy.hs view
@@ -0,0 +1,8 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+-- | Reexports "Test.Hspec" from a @Trustworthy@ module.+module TestHspecTrustworthy (module Test.Hspec) where++import Test.Hspec