th-orphans-0.13.4/0000755000000000000000000000000013136152671012055 5ustar0000000000000000th-orphans-0.13.4/CHANGELOG.md0000644000000000000000000000021713136152671013666 0ustar0000000000000000### 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.4/th-orphans.cabal0000644000000000000000000000413113136152671015123 0ustar0000000000000000name: th-orphans version: 0.13.4 cabal-version: >= 1.10 build-type: Simple license: BSD3 license-file: LICENSE category: Template Haskell author: Matt Morrow copyright: (c) Matt Morrow maintainer: Michael Sloan bug-reports: https://github.com/mgsloan/th-orphans/issues stability: experimental tested-with: GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2 , GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.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.3 && < 5, template-haskell, -- https://github.com/mboes/th-lift/issues/14 th-lift >= 0.7.1, th-reify-many >= 0.1 && < 0.2, th-lift-instances, mtl -- Use TH to derive Generics instances instead of DeriveGeneric, for < 7.10 if impl(ghc < 7.10) build-depends: generic-deriving >= 1.9 -- Prior to GHC 7.6, GHC generics lived in ghc-prim if impl(ghc >= 7.2) && impl(ghc < 7.6) build-depends: ghc-prim hs-source-dirs: src ghc-options: -Wall exposed-modules: Language.Haskell.TH.Instances default-language: Haskell2010 test-suite test type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs build-depends: base, th-orphans, hspec, template-haskell default-language: Haskell2010 source-repository head type: git location: https://github.com/mgsloan/th-orphans th-orphans-0.13.4/README.md0000644000000000000000000000155313136152671013340 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](https://img.shields.io/travis/mgsloan/th-orphans.svg)](https://travis-ci.org/mgsloan/th-orphans) [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.4/LICENSE0000644000000000000000000001744013136152671013070 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.4/Setup.hs0000644000000000000000000000007413136152671013512 0ustar0000000000000000import Distribution.Simple main :: IO () main = defaultMain th-orphans-0.13.4/src/0000755000000000000000000000000013136152671012644 5ustar0000000000000000th-orphans-0.13.4/src/Language/0000755000000000000000000000000013136152671014367 5ustar0000000000000000th-orphans-0.13.4/src/Language/Haskell/0000755000000000000000000000000013136152671015752 5ustar0000000000000000th-orphans-0.13.4/src/Language/Haskell/TH/0000755000000000000000000000000013136152671016265 5ustar0000000000000000th-orphans-0.13.4/src/Language/Haskell/TH/Instances.hs0000644000000000000000000003726113136152671020561 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} #if defined(__GLASGOW_HASKELL__) # define LANGUAGE_DeriveDataTypeable {-# LANGUAGE DeriveDataTypeable #-} #endif #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704 # define LANGUAGE_DeriveGeneric {-# LANGUAGE DeriveGeneric #-} #endif #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE DataKinds #-} #endif {-# OPTIONS_GHC -fno-warn-deprecations #-} {-# OPTIONS_GHC -fno-warn-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: -- -- * 'Ord', 'Lift', 'Generic', 'Show', 'Eq', 'Data', 'Typeable', -- 'Ppr', instances for the datatypes in "Language.Haskell.TH" -- -- * 'Lift' instances for "Data.Word" / "Data.Int" types -- -- * 'Applicative' for 'Q' -- -- * 'Quasi' for 'ReaderT', 'WriterT', 'StateT', and 'RWST'. -- -- * 'Typeable' for 'Lift', 'NameIs', 'Ppr', 'PprM', 'Q', 'Quasi', -- 'QuasiQuoter', and 'TExp' -- -- More recent versions of template-haskell, particularly 2.10 (GHC -- 7.10), provide these instances. However, in order to support older -- versions you should import this module. -- -- Note that the 'Ord' instances are not guaranteed to produce -- consistent results across template-haskell / GHC versions, as they -- have different data types, with different constructor orders. -- -- This module also implicitly re-exports the instances defined in -- "Instances.TH.Lift". This is mostly to ensure that there aren't -- collisions of orphans between @th-orphans@ and @th-lift-instances@. module Language.Haskell.TH.Instances () where import Language.Haskell.TH import Language.Haskell.TH.Lift (deriveLiftMany) import Language.Haskell.TH.ReifyMany import Language.Haskell.TH.Syntax import Data.Monoid (Monoid) import Control.Monad.Reader (ReaderT(ReaderT), runReaderT) import Control.Monad.RWS (RWST(RWST), runRWST) import Control.Monad.State (StateT(StateT), runStateT) import Control.Monad.Writer (WriterT(WriterT), runWriterT) import qualified Control.Monad.Trans as MTL (lift) import Instances.TH.Lift () -- Thanks to Richard Eisenberg, GHC 7.10 adds many of the instances -- from this module. #if !MIN_VERSION_template_haskell(2,10,0) import Data.Int (Int8, Int16, Int32, Int64) import Data.Word (Word8, Word16, Word32, Word64) import Language.Haskell.TH.Ppr # if MIN_VERSION_template_haskell(2,3,0) import Language.Haskell.TH.PprLib import Language.Haskell.TH.Quote # endif # if MIN_VERSION_template_haskell(2,4,0) && !(MIN_VERSION_template_haskell(2,8,0)) import Language.Haskell.TH.Syntax.Internals # endif # if !(MIN_VERSION_template_haskell(2,9,0)) # if !(MIN_VERSION_base(4,8,0)) import Control.Applicative (Applicative(..)) # endif import Control.Monad (ap, liftM) # endif # if !(MIN_VERSION_base(4,8,0)) import Data.Word (Word) # endif # if MIN_VERSION_template_haskell(2,3,0) && defined(LANGUAGE_DeriveDataTypeable) import Data.Data hiding (Fixity(..)) # endif # if __GLASGOW_HASKELL__ > 702 import GHC.Generics (Generic) # endif # if __GLASGOW_HASKELL__ <= 702 || !(MIN_VERSION_template_haskell(2,10,0)) import qualified Generics.Deriving.TH as Generic (deriveAll) # endif #endif #if !MIN_VERSION_template_haskell(2,11,0) deriving instance Show NameFlavour deriving instance Show NameSpace #endif -- Ideally, it'd be possible to use reifyManyWithoutInstances for -- these Ord instances, but TH can't output deriving instances (and -- even if this is added for later versions, we need to support many -- ghc / th versions). We can't generate Ord instances from TH due to -- some undiagnosed funkiness: -- https://github.com/mgsloan/th-orphans/issues/14 -- GHC 7.10 comes with Ord instances for TH datatypes. #if !MIN_VERSION_template_haskell(2,10,0) instance Ppr Lit where ppr = pprLit noPrec deriving instance Eq Info deriving instance Ord Body deriving instance Ord Callconv deriving instance Ord Clause deriving instance Ord Con deriving instance Ord Dec deriving instance Ord Exp deriving instance Ord Fixity deriving instance Ord FixityDirection deriving instance Ord Foreign deriving instance Ord FunDep deriving instance Ord Guard deriving instance Ord Info deriving instance Ord Lit deriving instance Ord Match deriving instance Ord Pat deriving instance Ord Range deriving instance Ord Safety deriving instance Ord Stmt deriving instance Ord Strict deriving instance Ord Type # if defined(LANGUAGE_DeriveDataTypeable) deriving instance Typeable NameIs deriving instance Typeable1 PprM deriving instance Typeable1 Q # endif # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic Body deriving instance Generic Callconv deriving instance Generic Clause deriving instance Generic Con deriving instance Generic Dec deriving instance Generic Exp deriving instance Generic Fixity deriving instance Generic FixityDirection deriving instance Generic Foreign deriving instance Generic FunDep deriving instance Generic Guard deriving instance Generic Info deriving instance Generic Lit deriving instance Generic Match deriving instance Generic Name deriving instance Generic NameSpace deriving instance Generic Pat deriving instance Generic Range deriving instance Generic Safety deriving instance Generic Stmt deriving instance Generic Strict deriving instance Generic Type # else $(Generic.deriveAll ''Body) $(Generic.deriveAll ''Callconv) $(Generic.deriveAll ''Clause) $(Generic.deriveAll ''Con) $(Generic.deriveAll ''Dec) $(Generic.deriveAll ''Exp) $(Generic.deriveAll ''Fixity) $(Generic.deriveAll ''FixityDirection) $(Generic.deriveAll ''Foreign) $(Generic.deriveAll ''FunDep) $(Generic.deriveAll ''Guard) $(Generic.deriveAll ''Info) $(Generic.deriveAll ''Lit) $(Generic.deriveAll ''Match) $(Generic.deriveAll ''Name) $(Generic.deriveAll ''NameSpace) $(Generic.deriveAll ''Pat) $(Generic.deriveAll ''Range) $(Generic.deriveAll ''Safety) $(Generic.deriveAll ''Stmt) $(Generic.deriveAll ''Strict) $(Generic.deriveAll ''Type) # endif -- Unconditionally use Template Haskell to derive this Generic instance, since -- NameFlavour has fields with unboxed types (for which deriving Generic -- support wasn't added to GHC until 8.0). $(Generic.deriveAll ''NameFlavour) # if MIN_VERSION_template_haskell(2,3,0) instance Ppr Loc where ppr (Loc { loc_module = md , loc_package = pkg , loc_start = (start_ln, start_col) , loc_end = (end_ln, end_col) }) = hcat [ text pkg, colon, text md, colon , parens $ int start_ln <> comma <> int start_col , text "-" , parens $ int end_ln <> comma <> int end_col ] deriving instance Eq Loc deriving instance Ord Loc deriving instance Show Loc # if defined(LANGUAGE_DeriveDataTypeable) deriving instance Data Loc deriving instance Typeable Loc deriving instance Typeable QuasiQuoter # endif # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic Loc # else $(Generic.deriveAll ''Loc) # endif # endif # if MIN_VERSION_template_haskell(2,4,0) deriving instance Ord FamFlavour deriving instance Ord Pragma deriving instance Ord Pred deriving instance Ord TyVarBndr # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic FamFlavour deriving instance Generic ModName deriving instance Generic OccName deriving instance Generic PkgName deriving instance Generic Pragma deriving instance Generic Pred deriving instance Generic TyVarBndr # else $(Generic.deriveAll ''FamFlavour) $(Generic.deriveAll ''ModName) $(Generic.deriveAll ''OccName) $(Generic.deriveAll ''PkgName) $(Generic.deriveAll ''Pragma) $(Generic.deriveAll ''Pred) $(Generic.deriveAll ''TyVarBndr) # endif # if !(MIN_VERSION_template_haskell(2,8,0)) deriving instance Ord InlineSpec deriving instance Ord Kind # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic InlineSpec deriving instance Generic Kind # else $(Generic.deriveAll ''InlineSpec) $(Generic.deriveAll ''Kind) # endif # endif # endif # if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) deriving instance Eq ClassInstance deriving instance Ord ClassInstance # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic ClassInstance # else $(Generic.deriveAll ''ClassInstance) # endif # endif # if !(MIN_VERSION_template_haskell(2,7,0)) instance Applicative Q where pure = return (<*>) = ap # endif # if MIN_VERSION_template_haskell(2,8,0) deriving instance Ord Inline deriving instance Ord Phases deriving instance Ord RuleBndr deriving instance Ord RuleMatch deriving instance Ord TyLit # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic Inline deriving instance Generic Phases deriving instance Generic RuleBndr deriving instance Generic RuleMatch deriving instance Generic TyLit # else $(Generic.deriveAll ''Inline) $(Generic.deriveAll ''Phases) $(Generic.deriveAll ''RuleBndr) $(Generic.deriveAll ''RuleMatch) $(Generic.deriveAll ''TyLit) # endif # endif # if MIN_VERSION_template_haskell(2,9,0) deriving instance Eq ModuleInfo deriving instance Ord AnnLookup deriving instance Ord AnnTarget deriving instance Ord ModuleInfo deriving instance Ord Role deriving instance Ord TySynEqn # if defined(LANGUAGE_DeriveDataTypeable) deriving instance Typeable TExp # endif # if defined(LANGUAGE_DeriveGeneric) deriving instance Generic AnnLookup deriving instance Generic AnnTarget deriving instance Generic Module deriving instance Generic ModuleInfo deriving instance Generic Role deriving instance Generic TySynEqn # else $(Generic.deriveAll ''AnnLookup) $(Generic.deriveAll ''AnnTarget) $(Generic.deriveAll ''Module) $(Generic.deriveAll ''ModuleInfo) $(Generic.deriveAll ''Role) $(Generic.deriveAll ''TySynEqn) # endif # else deriving instance Show ModName deriving instance Show OccName deriving instance Show PkgName instance Functor PprM where fmap = liftM instance Applicative PprM where pure = return (<*>) = ap # endif #endif instance Quasi m => Quasi (ReaderT r m) where qNewName = MTL.lift . qNewName qReport a b = MTL.lift $ qReport a b qRecover m1 m2 = ReaderT $ \ r -> runReaderT m1 r `qRecover` runReaderT m2 r qReify = MTL.lift . qReify qLocation = MTL.lift qLocation qRunIO = MTL.lift . qRunIO #if MIN_VERSION_template_haskell(2,7,0) qReifyInstances a b = MTL.lift $ qReifyInstances a b qLookupName a b = MTL.lift $ qLookupName a b qAddDependentFile = MTL.lift . qAddDependentFile # if MIN_VERSION_template_haskell(2,9,0) 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 # endif # if MIN_VERSION_template_haskell(2,11,0) qReifyFixity = MTL.lift . qReifyFixity qReifyConStrictness = MTL.lift . qReifyConStrictness qIsExtEnabled = MTL.lift . qIsExtEnabled qExtsEnabled = MTL.lift qExtsEnabled # endif #elif MIN_VERSION_template_haskell(2,5,0) qClassInstances a b = MTL.lift $ qClassInstances a b #endif #if MIN_VERSION_template_haskell(2,12,0) qAddForeignFile a b = MTL.lift $ qAddForeignFile a b #endif instance (Quasi m, Monoid w) => Quasi (WriterT w m) where qNewName = MTL.lift . qNewName qReport a b = MTL.lift $ qReport a b qRecover m1 m2 = WriterT $ runWriterT m1 `qRecover` runWriterT m2 qReify = MTL.lift . qReify qLocation = MTL.lift qLocation qRunIO = MTL.lift . qRunIO #if MIN_VERSION_template_haskell(2,7,0) qReifyInstances a b = MTL.lift $ qReifyInstances a b qLookupName a b = MTL.lift $ qLookupName a b qAddDependentFile = MTL.lift . qAddDependentFile # if MIN_VERSION_template_haskell(2,9,0) 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 # endif # if MIN_VERSION_template_haskell(2,11,0) qReifyFixity = MTL.lift . qReifyFixity qReifyConStrictness = MTL.lift . qReifyConStrictness qIsExtEnabled = MTL.lift . qIsExtEnabled qExtsEnabled = MTL.lift qExtsEnabled # endif #elif MIN_VERSION_template_haskell(2,5,0) qClassInstances a b = MTL.lift $ qClassInstances a b #endif #if MIN_VERSION_template_haskell(2,12,0) qAddForeignFile a b = MTL.lift $ qAddForeignFile a b #endif instance Quasi m => Quasi (StateT s m) where qNewName = MTL.lift . qNewName qReport a b = MTL.lift $ qReport a b qRecover m1 m2 = StateT $ \ s -> runStateT m1 s `qRecover` runStateT m2 s qReify = MTL.lift . qReify qLocation = MTL.lift qLocation qRunIO = MTL.lift . qRunIO #if MIN_VERSION_template_haskell(2,7,0) qReifyInstances a b = MTL.lift $ qReifyInstances a b qLookupName a b = MTL.lift $ qLookupName a b qAddDependentFile = MTL.lift . qAddDependentFile # if MIN_VERSION_template_haskell(2,9,0) 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 # endif # if MIN_VERSION_template_haskell(2,11,0) qReifyFixity = MTL.lift . qReifyFixity qReifyConStrictness = MTL.lift . qReifyConStrictness qIsExtEnabled = MTL.lift . qIsExtEnabled qExtsEnabled = MTL.lift qExtsEnabled # endif #elif MIN_VERSION_template_haskell(2,5,0) qClassInstances a b = MTL.lift $ qClassInstances a b #endif #if MIN_VERSION_template_haskell(2,12,0) qAddForeignFile a b = MTL.lift $ qAddForeignFile a b #endif instance (Quasi m, Monoid w) => Quasi (RWST r w s m) where qNewName = MTL.lift . qNewName qReport a b = MTL.lift $ qReport a b qRecover m1 m2 = RWST $ \ r s -> runRWST m1 r s `qRecover` runRWST m2 r s qReify = MTL.lift . qReify qLocation = MTL.lift qLocation qRunIO = MTL.lift . qRunIO #if MIN_VERSION_template_haskell(2,7,0) qReifyInstances a b = MTL.lift $ qReifyInstances a b qLookupName a b = MTL.lift $ qLookupName a b qAddDependentFile = MTL.lift . qAddDependentFile # if MIN_VERSION_template_haskell(2,9,0) 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 # endif # if MIN_VERSION_template_haskell(2,11,0) qReifyFixity = MTL.lift . qReifyFixity qReifyConStrictness = MTL.lift . qReifyConStrictness qIsExtEnabled = MTL.lift . qIsExtEnabled qExtsEnabled = MTL.lift qExtsEnabled # endif #elif MIN_VERSION_template_haskell(2,5,0) qClassInstances a b = MTL.lift $ qClassInstances a b #endif #if MIN_VERSION_template_haskell(2,12,0) qAddForeignFile a b = MTL.lift $ qAddForeignFile a b #endif #if MIN_VERSION_base(4,7,0) && defined(LANGUAGE_DeriveDataTypeable) && __GLASGOW_HASKELL__ < 710 deriving instance Typeable Lift deriving instance Typeable Ppr deriving instance Typeable Quasi #endif $(reifyManyWithoutInstances ''Lift [''Info, ''Loc] (const True) >>= deriveLiftMany) th-orphans-0.13.4/test/0000755000000000000000000000000013136152671013034 5ustar0000000000000000th-orphans-0.13.4/test/Spec.hs0000644000000000000000000000144713136152671014270 0ustar0000000000000000{-# LANGUAGE TemplateHaskell #-} import Language.Haskell.TH import Language.Haskell.TH.Instances import System.Timeout import Test.Hspec 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