Hello community, here is the log from the commit of package ghc-th-orphans for openSUSE:Factory checked in at 2019-04-03 09:27:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-th-orphans (Old) and /work/SRC/openSUSE:Factory/.ghc-th-orphans.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-th-orphans" Wed Apr 3 09:27:26 2019 rev:6 rq:690183 version:0.13.7 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-th-orphans/ghc-th-orphans.changes 2018-10-25 09:06:18.250506287 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-th-orphans.new.25356/ghc-th-orphans.changes 2019-04-03 09:27:28.579800014 +0200 @@ -1,0 +2,11 @@ +Mon Mar 25 11:50:15 UTC 2019 - [email protected] + +- Update th-orphans to version 0.13.7. + ### 0.13.7 [2019.03.24] + * Backport the `MonadFail Q` instance. + * Allow building with `template-haskell-2.16` by manually implementing + `Lift` for `Bytes`. See [#27] + + [#27]: https://github.com/mgsloan/th-orphans/issues/27 + +------------------------------------------------------------------- Old: ---- th-orphans-0.13.6.tar.gz New: ---- th-orphans-0.13.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-th-orphans.spec ++++++ --- /var/tmp/diff_new_pack.KxeLTj/_old 2019-04-03 09:27:29.399800400 +0200 +++ /var/tmp/diff_new_pack.KxeLTj/_new 2019-04-03 09:27:29.403800402 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-th-orphans # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name th-orphans %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.13.6 +Version: 0.13.7 Release: 0 Summary: Orphan instances for TH datatypes License: BSD-3-Clause @@ -34,6 +34,7 @@ BuildRequires: ghc-th-lift-instances-devel BuildRequires: ghc-th-reify-many-devel %if %{with tests} +BuildRequires: ghc-bytestring-devel BuildRequires: ghc-hspec-devel %endif ++++++ th-orphans-0.13.6.tar.gz -> th-orphans-0.13.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/th-orphans-0.13.6/CHANGELOG.md new/th-orphans-0.13.7/CHANGELOG.md --- old/th-orphans-0.13.6/CHANGELOG.md 2018-07-01 13:48:49.000000000 +0200 +++ new/th-orphans-0.13.7/CHANGELOG.md 2019-03-25 02:07:45.000000000 +0100 @@ -1,3 +1,10 @@ +### 0.13.7 [2019.03.24] +* Backport the `MonadFail Q` instance. +* Allow building with `template-haskell-2.16` by manually implementing + `Lift` for `Bytes`. See [#27] + +[#27]: https://github.com/mgsloan/th-orphans/issues/27 + ### 0.13.6 [2018.07.01] * Allow building with `template-haskell-2.14`. * Implement `qAddForeignFilePath` and `qAddTempFile` for `Quasi` instances diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/th-orphans-0.13.6/src/Language/Haskell/TH/Instances.hs new/th-orphans-0.13.7/src/Language/Haskell/TH/Instances.hs --- old/th-orphans-0.13.6/src/Language/Haskell/TH/Instances.hs 2018-07-01 13:48:49.000000000 +0200 +++ new/th-orphans-0.13.7/src/Language/Haskell/TH/Instances.hs 2019-03-25 02:07:45.000000000 +0100 @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE TemplateHaskell #-} @@ -69,6 +70,10 @@ import qualified Control.Monad.Trans as MTL (lift) import Instances.TH.Lift () +#if !(MIN_VERSION_template_haskell(2,8,0)) +import Unsafe.Coerce (unsafeCoerce) +#endif + -- Thanks to Richard Eisenberg, GHC 7.10 adds many of the instances -- from this module. #if !MIN_VERSION_template_haskell(2,10,0) @@ -108,9 +113,36 @@ # endif #endif +#if !(MIN_VERSION_template_haskell(2,11,0)) +import qualified Control.Monad.Fail as Fail +#endif + +-- TODO: Once GHC 8.10 is released, this should be updated to use the +-- proper template haskell version. Other related usages of this #if +-- should be replaced as well (and do not have a TODO like this). +-- +-- #if MIN_VERSION_template_haskell(2,16,0) +#if __GLASGOW_HASKELL__ >= 809 +import GHC.Ptr (Ptr(Ptr)) +import GHC.ForeignPtr (newForeignPtr_) +import System.IO.Unsafe (unsafePerformIO) +#endif + #if !MIN_VERSION_template_haskell(2,11,0) deriving instance Show NameFlavour deriving instance Show NameSpace + +instance Fail.MonadFail Q where + fail s = report True s >> q (fail "Q monad failure") + where + q :: (forall m. Quasi m => m a) -> Q a +# if MIN_VERSION_template_haskell(2,8,0) + q = Q +# else + -- Early versions of template-haskell did not expose Q's newtype + -- constructor. Desperate times call for desperate measures. + q = unsafeCoerce +# endif #endif -- Ideally, it'd be possible to use reifyManyWithoutInstances for @@ -517,5 +549,18 @@ deriving instance Typeable Quasi #endif +#if __GLASGOW_HASKELL__ >= 809 +instance Lift Bytes where + lift bytes = + [| Bytes + { bytesPtr = unsafePerformIO $ newForeignPtr_ (Ptr $(litE (BytesPrimL bytes))) + , bytesOffset = 0 + , bytesSize = size + } + |] + where + size = bytesSize bytes +#endif + $(reifyManyWithoutInstances ''Lift [''Info, ''Loc] (const True) >>= deriveLiftMany) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/th-orphans-0.13.6/test/Spec.hs new/th-orphans-0.13.7/test/Spec.hs --- old/th-orphans-0.13.6/test/Spec.hs 2018-07-01 13:48:49.000000000 +0200 +++ new/th-orphans-0.13.7/test/Spec.hs 2019-03-25 02:07:45.000000000 +0100 @@ -1,9 +1,15 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} +import Control.Exception (evaluate) import Language.Haskell.TH import Language.Haskell.TH.Instances +import Language.Haskell.TH.Lift import System.Timeout -import Test.Hspec +import System.Mem +import Test.Hspec hiding (runIO) +import TestUtil +import qualified Data.ByteString as BS main :: IO () main = hspec $ do @@ -19,3 +25,16 @@ it "Compares types correctly" $ compare (AppT (ConT ''Maybe) (ConT ''Int)) (AppT (ConT ''Maybe) (ConT ''Char)) `shouldBe` GT +#if __GLASGOW_HASKELL__ >= 809 + it "Lifts bytes" $ do + let addr = $(do + let result = $(do + ast <- lift (LitE (BytesPrimL (bsToBytes testBytes))) + runIO performMajorGC + return ast) + runIO $ evaluate result + runIO performMajorGC + return result) + bs <- addrToBs addr (BS.length testBytes) + bs `shouldBe` testBytes +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/th-orphans-0.13.6/test/TestUtil.hs new/th-orphans-0.13.7/test/TestUtil.hs --- old/th-orphans-0.13.6/test/TestUtil.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/th-orphans-0.13.7/test/TestUtil.hs 2019-03-25 02:07:45.000000000 +0100 @@ -0,0 +1,38 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE OverloadedStrings #-} + +module TestUtil where + +#if __GLASGOW_HASKELL__ >= 809 + +import Language.Haskell.TH.Syntax +import qualified Data.ByteString as BS +import qualified Data.ByteString.Internal as BS +import GHC.Prim (Addr#) +import GHC.ForeignPtr (newForeignPtr_) +import GHC.Ptr (Ptr(Ptr)) + +testBytes :: BS.ByteString +testBytes = + "test bytes " <> + (BS.take (len - 2) $ BS.drop 1 $ BS.replicate len 42) + where + len = 20 * 1024 * 1024 + +bsToBytes :: BS.ByteString -> Bytes +bsToBytes bs = + Bytes + { bytesPtr = fp + , bytesOffset = fromIntegral offset + , bytesSize = fromIntegral size + } + where + (fp, offset, size) = BS.toForeignPtr bs + +addrToBs :: Addr# -> Int -> IO BS.ByteString +addrToBs addr len = do + fp <- newForeignPtr_ (Ptr addr) + return $ BS.fromForeignPtr fp 0 len + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/th-orphans-0.13.6/th-orphans.cabal new/th-orphans-0.13.7/th-orphans.cabal --- old/th-orphans-0.13.6/th-orphans.cabal 2018-07-01 13:48:49.000000000 +0200 +++ new/th-orphans-0.13.7/th-orphans.cabal 2019-03-25 02:07:45.000000000 +0100 @@ -1,5 +1,5 @@ name: th-orphans -version: 0.13.6 +version: 0.13.7 cabal-version: >= 1.10 build-type: Simple license: BSD3 @@ -18,8 +18,8 @@ , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2 - , GHC == 8.4.3 - , GHC == 8.6.1 + , GHC == 8.4.4 + , GHC == 8.6.4 synopsis: Orphan instances for TH datatypes description: Orphan instances for TH datatypes. In particular, instances for Ord and Lift, as well as a few missing Show / Eq. These @@ -36,6 +36,9 @@ th-lift-instances, mtl + if !impl(ghc >= 8.0) + build-depends: fail == 4.9.* + -- Use TH to derive Generics instances instead of DeriveGeneric, for < 7.10 if impl(ghc < 7.10) build-depends: generic-deriving >= 1.9 @@ -53,10 +56,14 @@ type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs + other-modules: TestUtil build-depends: base, - th-orphans, + bytestring, + ghc-prim, hspec, - template-haskell + template-haskell, + th-lift, + th-orphans build-tool-depends: hspec-discover:hspec-discover default-language: Haskell2010
