th-reify-compat-0.0.1.3/0000755000000000000000000000000013164621720013051 5ustar0000000000000000th-reify-compat-0.0.1.3/th-reify-compat.cabal0000644000000000000000000000350013164621720017043 0ustar0000000000000000 name: th-reify-compat version: 0.0.1.3 synopsis: Compatibility for the result type of TH reify description: This package contains compatible interfaces against the result type of TH reify function. homepage: http://github.com/khibino/haskell-th-reify-compat/ license: BSD3 license-file: LICENSE author: Kei Hibino maintainer: ex8k.hibino@gmail.com copyright: Copyright (c) 2016-2017 Kei Hibino category: Language build-type: Simple cabal-version: >=1.10 tested-with: GHC == 8.2.1 , GHC == 8.0.1, GHC == 8.0.2 , GHC == 7.10.1, GHC == 7.10.2, GHC == 7.10.3 , GHC == 7.8.1, GHC == 7.8.2, GHC == 7.8.3, GHC == 7.8.4 , GHC == 7.6.1, GHC == 7.6.2, GHC == 7.6.3 , GHC == 7.4.1, GHC == 7.4.2 flag template-haskell-210 description: If true, use template-haskell 2.10 or older, otherwise use template-haskell 2.11 or newer. default: False library exposed-modules: Language.Haskell.TH.Compat.Reify if flag(template-haskell-210) other-modules: Language.Haskell.TH.Compat.Reify.V210 build-depends: template-haskell <2.11 else other-modules: Language.Haskell.TH.Compat.Reify.Current build-depends: template-haskell >=2.11 build-depends: base <5 other-extensions: CPP hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall source-repository head type: git location: https://github.com/khibino/haskell-th-reify-compat source-repository head type: mercurial location: https://bitbucket.org/khibino/haskell-th-reify-compat th-reify-compat-0.0.1.3/Setup.hs0000644000000000000000000000005613164621720014506 0ustar0000000000000000import Distribution.Simple main = defaultMain th-reify-compat-0.0.1.3/LICENSE0000644000000000000000000000275613164621720014070 0ustar0000000000000000Copyright (c) 2016, Kei Hibino 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 the name of Kei Hibino nor the names of other contributors may 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. th-reify-compat-0.0.1.3/src/0000755000000000000000000000000013164621720013640 5ustar0000000000000000th-reify-compat-0.0.1.3/src/Language/0000755000000000000000000000000013164621720015363 5ustar0000000000000000th-reify-compat-0.0.1.3/src/Language/Haskell/0000755000000000000000000000000013164621720016746 5ustar0000000000000000th-reify-compat-0.0.1.3/src/Language/Haskell/TH/0000755000000000000000000000000013164621720017261 5ustar0000000000000000th-reify-compat-0.0.1.3/src/Language/Haskell/TH/Compat/0000755000000000000000000000000013164621720020504 5ustar0000000000000000th-reify-compat-0.0.1.3/src/Language/Haskell/TH/Compat/Reify.hs0000644000000000000000000000134513164621720022121 0ustar0000000000000000{-# LANGUAGE CPP #-} -- | -- Module : Language.Haskell.TH.Compat.Reify -- Copyright : 2016 Kei Hibino -- License : BSD3 -- -- Maintainer : ex8k.hibino@gmail.com -- Stability : experimental -- Portability : unknown -- -- This module provides compatibility definitions of -- destructuring result type of reify for before temaplate-haskell-2.11 module Language.Haskell.TH.Compat.Reify ( -- * Interfaces to destruct reify result unClassOpI, unDataConI, unVarI, -- * Interface to get operator fixity reifyFixity, -- * Interface of type alias name ParentName, ) where #if MIN_VERSION_template_haskell(2,11,0) import Language.Haskell.TH.Compat.Reify.Current #else import Language.Haskell.TH.Compat.Reify.V210 #endif th-reify-compat-0.0.1.3/src/Language/Haskell/TH/Compat/Reify/0000755000000000000000000000000013164621720021562 5ustar0000000000000000th-reify-compat-0.0.1.3/src/Language/Haskell/TH/Compat/Reify/V210.hs0000644000000000000000000000212713164621720022550 0ustar0000000000000000module Language.Haskell.TH.Compat.Reify.V210 ( ParentName, unClassOpI, unDataConI, unVarI, reifyFixity, )where import Language.Haskell.TH (Info (..), Name, Type, Dec, Fixity) -- | ParentName type alias is not defined before template-haskell-2.8 type ParentName = Name -- | Compatible interface to destruct 'ClassOpI' unClassOpI :: Info -> Maybe (Name, Type, ParentName) unClassOpI (ClassOpI n t p _) = Just (n, t, p) unClassOpI _ = Nothing -- | Compatible interface to destruct 'DataConI' unDataConI :: Info -> Maybe (Name, Type, ParentName) unDataConI (DataConI n t p _) = Just (n, t, p) unDataConI _ = Nothing -- | Compatible interface to destruct 'VarI' unVarI :: Info -> Maybe (Name, Type, Maybe Dec) unVarI (VarI n t md _) = Just (n, t, md) unVarI _ = Nothing -- | Compatible interface to get operator fixity before temaplate-haskell-2.11 reifyFixity :: Info -> Maybe Fixity reifyFixity = d where d (ClassOpI _ _ _ f) = Just f d (DataConI _ _ _ f) = Just f d (VarI _ _ _ f) = Just f d _ = Nothing th-reify-compat-0.0.1.3/src/Language/Haskell/TH/Compat/Reify/Current.hs0000644000000000000000000000134513164621720023543 0ustar0000000000000000module Language.Haskell.TH.Compat.Reify.Current ( ParentName, unClassOpI, unDataConI, unVarI, reifyFixity, )where import Language.Haskell.TH (Info (..), Name, Type, ParentName, Dec, reifyFixity) -- | Compatible interface to destruct 'ClassOpI' unClassOpI :: Info -> Maybe (Name, Type, ParentName) unClassOpI (ClassOpI n t p) = Just (n, t, p) unClassOpI _ = Nothing -- | Compatible interface to destruct 'DataConI' unDataConI :: Info -> Maybe (Name, Type, ParentName) unDataConI (DataConI n t p) = Just (n, t, p) unDataConI _ = Nothing -- | Compatible interface to destruct 'VarI' unVarI :: Info -> Maybe (Name, Type, Maybe Dec) unVarI (VarI n t md) = Just (n, t, md) unVarI _ = Nothing