th-orphans-0.13.16/0000755000000000000000000000000007346545000012136 5ustar0000000000000000th-orphans-0.13.16/CHANGELOG.md0000644000000000000000000000406407346545000013753 0ustar0000000000000000### 0.13.16 [2024.12.05] * Support building with `template-haskell-2.23.0`. ### 0.13.15 [2024.10.22] * Support building with `template-haskell-2.22.1`. * Drop support for pre-8.0 versions of GHC. ### 0.13.14 [2022.08.21] * Only depend on `th-lift-instances` for `ghc <= 7.8`. ### 0.13.13 [2022.05.19] * Implement `qGetPackageRoot` (introduced in `template-haskell-2.19.0.0`) for the `Quasi` instances defined in `th-orphans`. ### 0.13.12 [2021.08.30] * Implement `qGetDoc` and `qPutDoc` (introduced in `template-haskell-2.18.0.0`) for the `Quasi` instances defined in `th-orphans`. ### 0.13.11 [2020.09.29] * Allow building with `template-haskell-2.17.0.0` (GHC 9.0). * Define `Quote` instances for `ReaderT`, `StateT`, `WriterT`, and `RWST`. In order to define these instances on as many versions of `template-haskell` as possible, this library now depends on the `th-compat` library, which backports the `Quote` class to older versions of `template-haskell`. * Backport the `Semigroup`, `Monoid`, and `MonadFix` instances for `Q` that were introduced in `template-haskell-2.17.0.0`. ### 0.13.10 [2020.04.13] * Implement `liftTyped` in the `Lift Bytes` instance. ### 0.13.9 [2019.09.28] * Implement `qReifyType` (introduced in `template-haskell-2.16.0.0`) for the `Quasi` instances defined in `th-orphans`. ### 0.13.8 [2019.09.04] * Backport the `Bounded` instance for `Extension` (from `Language.Haskell.TH.LanguageExtensions`), which was introduced in `template-haskell-2.15.0.0`. ### 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 ### 0.13.5 [2018.01.18] * Implement `qAddCorePlugin` for `Quasi` instances ### 0.13.4 [2017.07.26] * Implement `qAddForeignFile` for `Quasi` instances ### 0.13.3 [2016.11.09] * Backport `Generic NameFlavour` instance th-orphans-0.13.16/LICENSE0000644000000000000000000001744007346545000013151 0ustar0000000000000000----------------------------------------------------------------------------- ----------------------------------------------------------------------------- metaquote Copyright (c) Matt Morrow. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- th-lift Copyright (c) Ian Lynagh. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- haskell-src-exts This library (Haskell Source eXtensions) is derived from code from several sources: * Code from the GHC project which is largely (c) The University of Glasgow, and distributable under a BSD-style license (see below), * Code from the Haskell 98 Report which is (c) Simon Peyton Jones and freely redistributable (but see the full license for restrictions). The full text of these licenses is reproduced below. All of the licenses are BSD-style or compatible. ----------------------------------------------------------------------------- The haskell-src-exts package itself is distributable under the modified BSD license: Copyright (c) 2005, Niklas Broberg All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- The Glasgow Haskell Compiler License Copyright 2004, The University Court of the University of Glasgow. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- Code derived from the document "Report on the Programming Language Haskell 98", is distributed under the following license: Copyright (c) 2002 Simon Peyton Jones The authors intend this Report to belong to the entire Haskell community, and so we grant permission to copy and distribute it for any purpose, provided that it is reproduced in its entirety, including this Notice. Modified versions of this Report may also be copied and distributed for any purpose, provided that the modified version is clearly presented as such, and that it does not claim to be a definition of the Haskell 98 Language. ----------------------------------------------------------------------------- th-orphans-0.13.16/README.md0000644000000000000000000000164307346545000013421 0ustar0000000000000000# `th-orphans` [![Hackage](https://img.shields.io/hackage/v/th-orphans.svg)][Hackage: th-orphans] [![Hackage Dependencies](https://img.shields.io/hackage-deps/v/th-orphans.svg)](http://packdeps.haskellers.com/reverse/th-orphans) [![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org] [![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)][tl;dr Legal: BSD3] [![Build Status](https://github.com/mgsloan/th-orphans/workflows/Haskell-CI/badge.svg)](https://github.com/mgsloan/th-orphans/actions?query=workflow%3AHaskell-CI) [Hackage: th-orphans]: http://hackage.haskell.org/package/th-orphans "th-orphans package on Hackage" [Haskell.org]: http://www.haskell.org "The Haskell Programming Language" [tl;dr Legal: BSD3]: https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29 "BSD 3-Clause License (Revised)" Orphan instances for TH datatypes th-orphans-0.13.16/Setup.hs0000644000000000000000000000007407346545000013573 0ustar0000000000000000import Distribution.Simple main :: IO () main = defaultMain th-orphans-0.13.16/src/Language/Haskell/TH/0000755000000000000000000000000007346545000016346 5ustar0000000000000000th-orphans-0.13.16/src/Language/Haskell/TH/Instances.hs0000644000000000000000000001074507346545000020640 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-deprecations #-} {-# OPTIONS_GHC -Wno-orphans #-} -- | -- Module : Language.Haskell.TH.Instances -- Copyright : (c) Matt Morrow 2008 -- License : BSD3 -- Maintainer : Michael Sloan -- Stability : experimental -- Portability : portable (template-haskell) -- -- It provides the following instances: -- -- * 'Lift' instances for the datatypes in "Language.Haskell.TH" -- -- * 'Quasi' for 'ReaderT', 'WriterT', 'StateT', and 'RWST'. -- -- * 'MonadFix' for 'Q' -- -- More recent versions of template-haskell provide these instances. However, in -- order to support older versions you should import this module. module Language.Haskell.TH.Instances () where import Language.Haskell.TH hiding (newName) import Language.Haskell.TH.Instances.Internal import Language.Haskell.TH.Lift (deriveLiftMany) import Language.Haskell.TH.ReifyMany import Language.Haskell.TH.Syntax hiding (newName) import Language.Haskell.TH.Syntax.Compat (Quote(..)) import Control.Monad.Reader (ReaderT(ReaderT), runReaderT) import Control.Monad.RWS (RWST(RWST), runRWST) import Control.Monad.State (StateT(StateT), runStateT) import qualified Control.Monad.Trans as Trans (MonadTrans(lift)) import Control.Monad.Writer (WriterT(WriterT), runWriterT) #if !(MIN_VERSION_template_haskell(2,15,0)) import Language.Haskell.TH.LanguageExtensions (Extension(..)) #endif #if MIN_VERSION_template_haskell(2,16,0) && !(MIN_VERSION_template_haskell(2,23,0)) import GHC.Ptr (Ptr(Ptr)) import GHC.ForeignPtr (newForeignPtr_) import Language.Haskell.TH.Syntax.Compat (liftTypedFromUntypedSplice) import System.IO.Unsafe (unsafePerformIO) #endif #if !MIN_VERSION_template_haskell(2,17,0) import Control.Applicative (liftA2) import Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar) import Control.Monad.Fix (MonadFix (..)) import System.IO.Unsafe (unsafeInterleaveIO) import qualified Data.Semigroup as Semi # if MIN_VERSION_base(4,11,0) import Control.Exception (throwIO, catch) import GHC.IO.Exception (BlockedIndefinitelyOnMVar (..), FixIOException (..)) # endif #endif #if !(MIN_VERSION_template_haskell(2,15,0)) deriving instance Bounded Extension #endif instance Quote m => Quote (ReaderT r m) where newName = Trans.lift . newName $(deriveQuasiTrans [t| forall r m. Quasi m => Quasi (ReaderT r m) |] [e| \m1 m2 -> ReaderT $ \ r -> runReaderT m1 r `qRecover` runReaderT m2 r |]) instance (Quote m, Monoid w) => Quote (WriterT w m) where newName = Trans.lift . newName $(deriveQuasiTrans [t| forall w m. (Quasi m, Monoid w) => Quasi (WriterT w m) |] [e| \m1 m2 -> WriterT $ runWriterT m1 `qRecover` runWriterT m2 |]) instance Quote m => Quote (StateT s m) where newName = Trans.lift . newName $(deriveQuasiTrans [t| forall s m. Quasi m => Quasi (StateT s m) |] [e| \m1 m2 -> StateT $ \ s -> runStateT m1 s `qRecover` runStateT m2 s |]) instance (Quote m, Monoid w) => Quote (RWST r w s m) where newName = Trans.lift . newName $(deriveQuasiTrans [t| forall r w s m. (Quasi m, Monoid w) => Quasi (RWST r w s m) |] [e| \m1 m2 -> RWST $ \ r s -> runRWST m1 r s `qRecover` runRWST m2 r s |]) #if MIN_VERSION_template_haskell(2,16,0) && !(MIN_VERSION_template_haskell(2,23,0)) instance Lift Bytes where lift bytes = [| Bytes { bytesPtr = unsafePerformIO $ newForeignPtr_ (Ptr $(litE (BytesPrimL bytes))) , bytesOffset = 0 , bytesSize = size } |] where size = bytesSize bytes liftTyped = liftTypedFromUntypedSplice #endif #if !MIN_VERSION_template_haskell(2,17,0) instance Semi.Semigroup a => Semi.Semigroup (Q a) where (<>) = liftA2 (Semi.<>) instance Monoid a => Monoid (Q a) where mempty = return mempty #if !MIN_VERSION_base(4,11,0) mappend = liftA2 mappend #endif -- | If the function passed to 'mfix' inspects its argument, -- the resulting action will throw a 'FixIOException' -- (@base >=4.11@) or a 'BlockedIndefinitelyOnMVar' -- with older @base@. -- instance MonadFix Q where mfix k = do m <- runIO newEmptyMVar ans <- runIO (unsafeInterleaveIO (readMVar m #if MIN_VERSION_base(4,11,0) `catch` \BlockedIndefinitelyOnMVar -> throwIO FixIOException #endif )) result <- k ans runIO (putMVar m result) return result #endif $(reifyManyWithoutInstances ''Lift [''Info, ''Loc] (const True) >>= deriveLiftMany) th-orphans-0.13.16/src/Language/Haskell/TH/Instances/0000755000000000000000000000000007346545000020275 5ustar0000000000000000th-orphans-0.13.16/src/Language/Haskell/TH/Instances/Internal.hs0000644000000000000000000000754707346545000022422 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} -- | Defines a utility function for deriving 'Quasi' instances for monad -- transformer data types. module Language.Haskell.TH.Instances.Internal (deriveQuasiTrans) where import qualified Control.Monad.Trans as MTL (lift) import Language.Haskell.TH.Lib import Language.Haskell.TH.Ppr (pprint) import Language.Haskell.TH.Syntax deriveQuasiTrans :: Q Type -- ^ The instance head. For example, this might be of the form: -- -- > [t| forall r m. Quasi m => Quasi (ReaderT r m) |] -> Q Exp -- ^ The implementation of 'qRecover' -> Q [Dec] -- ^ The 'Quasi' instance declaration deriveQuasiTrans qInstHead qRecoverExpr = do instHead <- qInstHead let (instCxt, mangledInstTy) = decomposeType instHead qInstCxt = return instCxt qInstTy = case mangledInstTy of ConT proxy2 `AppT` instTy | proxy2 == ''Quasi -> conT ''Quasi `appT` return instTy _ -> fail $ "Unexpected type " ++ pprint mangledInstTy instDec <- instanceD qInstCxt qInstTy qInstMethDecs return [instDec] where decomposeType :: Type -> (Cxt, Type) decomposeType (ForallT _tvbs ctxt ty) = (ctxt, ty) decomposeType ty = ([], ty) qInstMethDecs :: [Q Dec] qInstMethDecs = let instMeths :: [(Name, Q Exp)] instMeths = [ -- qRecover is different for each instance ('qRecover, qRecoverExpr) -- The remaining methods are straightforward , ('qNewName, [| MTL.lift . qNewName |]) , ('qReport, [| \a b -> MTL.lift $ qReport a b |]) , ('qReify, [| MTL.lift . qReify |]) , ('qLocation, [| MTL.lift qLocation |]) , ('qRunIO, [| MTL.lift . qRunIO |]) , ('qReifyInstances, [| \a b -> MTL.lift $ qReifyInstances a b |]) , ('qLookupName, [| \a b -> MTL.lift $ qLookupName a b |]) , ('qAddDependentFile, [| MTL.lift . qAddDependentFile |]) , ('qReifyRoles, [| MTL.lift . qReifyRoles |]) , ('qReifyAnnotations, [| MTL.lift . qReifyAnnotations |]) , ('qReifyModule, [| MTL.lift . qReifyModule |]) , ('qAddTopDecls, [| MTL.lift . qAddTopDecls |]) , ('qAddModFinalizer, [| MTL.lift . qAddModFinalizer |]) , ('qGetQ, [| MTL.lift qGetQ |]) , ('qPutQ, [| MTL.lift . qPutQ |]) , ('qReifyFixity, [| MTL.lift . qReifyFixity |]) , ('qReifyConStrictness, [| MTL.lift . qReifyConStrictness |]) , ('qIsExtEnabled, [| MTL.lift . qIsExtEnabled |]) , ('qExtsEnabled, [| MTL.lift qExtsEnabled |]) #if MIN_VERSION_template_haskell(2,14,0) , ('qAddForeignFilePath, [| \a b -> MTL.lift $ qAddForeignFilePath a b |]) , ('qAddTempFile, [| MTL.lift . qAddTempFile |]) #elif MIN_VERSION_template_haskell(2,12,0) , ('qAddForeignFile, [| \a b -> MTL.lift $ qAddForeignFile a b |]) #endif #if MIN_VERSION_template_haskell(2,13,0) , ('qAddCorePlugin, [| MTL.lift . qAddCorePlugin |]) #endif #if MIN_VERSION_template_haskell(2,16,0) , ('qReifyType, [| MTL.lift . qReifyType |]) #endif #if MIN_VERSION_template_haskell(2,18,0) , ('qGetDoc, [| MTL.lift . qGetDoc |]) , ('qPutDoc, [| \a b -> MTL.lift $ qPutDoc a b |]) #endif #if MIN_VERSION_template_haskell(2,19,0) , ('qGetPackageRoot, [| MTL.lift qGetPackageRoot |]) #endif ] mkDec :: Name -> Q Exp -> Q Dec mkDec methName methRhs = valD (varP methName) (normalB methRhs) [] in map (uncurry mkDec) instMeths th-orphans-0.13.16/test/0000755000000000000000000000000007346545000013115 5ustar0000000000000000th-orphans-0.13.16/test/Spec.hs0000644000000000000000000000267107346545000014351 0ustar0000000000000000{-# 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 System.Mem import Test.Hspec hiding (runIO) import TestUtil import qualified Data.ByteString as BS main :: IO () main = hspec $ do -- See https://github.com/mgsloan/th-orphans/issues/13 it "Doesn't infinite loop when comparing types" $ do -- This can either yield LT or GT because different TH -- versions define the constructors in different orders. result <- timeout (1000 * 100) $ compare (AppT (ConT ''Maybe) (ConT ''Int)) (ConT ''Char) `shouldSatisfy` (/= EQ) result `shouldBe` Just () -- See https://github.com/mgsloan/th-orphans/issues/14 it "Compares types correctly" $ compare (AppT (ConT ''Maybe) (ConT ''Int)) (AppT (ConT ''Maybe) (ConT ''Char)) `shouldBe` GT #if MIN_VERSION_template_haskell(2,16,0) 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 th-orphans-0.13.16/test/TestUtil.hs0000644000000000000000000000155007346545000015227 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE OverloadedStrings #-} module TestUtil where #if MIN_VERSION_template_haskell(2,16,0) 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 th-orphans-0.13.16/th-orphans.cabal0000644000000000000000000000464207346545000015213 0ustar0000000000000000name: th-orphans version: 0.13.16 cabal-version: >= 1.10 build-type: Simple license: BSD3 license-file: LICENSE category: Template Haskell author: Matt Morrow, Michael Sloan, Ryan Scott copyright: (c) Matt Morrow, Michael Sloan, Ryan Scott maintainer: Ryan Scott bug-reports: https://github.com/mgsloan/th-orphans/issues stability: experimental tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.8 , GHC == 9.6.6 , GHC == 9.8.4 , GHC == 9.10.1 , GHC == 9.12.1 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 instances used to live in haskell-src-meta, and that's where the version number started. extra-source-files: CHANGELOG.md, README.md library build-depends: base >= 4.9 && < 5, template-haskell >= 2.11 && < 2.24, th-compat >= 0.1 && < 0.2, -- https://github.com/mboes/th-lift/issues/14 th-lift >= 0.7.1, th-reify-many >= 0.1.9 && < 0.2, mtl >= 2 hs-source-dirs: src ghc-options: -Wall if impl(ghc >= 8.6) ghc-options: -Wno-star-is-type exposed-modules: Language.Haskell.TH.Instances other-modules: Language.Haskell.TH.Instances.Internal default-language: Haskell2010 test-suite test type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs other-modules: TestUtil build-depends: base, bytestring, ghc-prim, hspec, template-haskell, th-lift, th-orphans build-tool-depends: hspec-discover:hspec-discover default-language: Haskell2010 source-repository head type: git location: https://github.com/mgsloan/th-orphans