th-orphans 0.5.2.0 → 0.6
raw patch · 2 files changed
+65/−18 lines, 2 filesdep ~basedep ~template-haskell
Dependency ranges changed: base, template-haskell
Files
- src/Language/Haskell/TH/Instances.hs +59/−15
- th-orphans.cabal +6/−3
src/Language/Haskell/TH/Instances.hs view
@@ -6,7 +6,7 @@ Module : Language.Haskell.TH.Instances.Lift Copyright : (c) Matt Morrow 2008 License : BSD3- Maintainer : Matt Morrow <mjm2002@gmail.com>+ Maintainer : Michael Sloan <mgsloan at gmail> Stability : experimental Portability : portable (template-haskell) -}@@ -18,12 +18,25 @@ import Language.Haskell.TH.Syntax import Language.Haskell.TH.Ppr import Language.Haskell.TH.Lift (deriveLiftMany)+import GHC.Word ( Word8 ) ++-- Orphan Show instances deriving instance Show Loc ++-- Orphan Eq instances deriving instance Eq Loc deriving instance Eq Info ++-- Orphan Ord instances+instance Ord FixityDirection where+ (<=) InfixL _ = True+ (<=) _ InfixR = True+ (<=) InfixN InfixN = True+ (<=) _ _ = False+ deriving instance Ord Info deriving instance Ord Fixity deriving instance Ord Exp@@ -45,20 +58,32 @@ deriving instance Ord Lit #if MIN_VERSION_template_haskell(2,4,0)-deriving instance Ord TyVarBndr-deriving instance Ord Pred-deriving instance Ord Kind deriving instance Ord FamFlavour-deriving instance Ord InlineSpec deriving instance Ord Pragma-#endif /* MIN_VERSION_template_haskell(2,4,0) */+deriving instance Ord Pred+deriving instance Ord TyVarBndr+#endif -instance Ord FixityDirection where- (<=) InfixL _ = True- (<=) _ InfixR = True- (<=) InfixN InfixN = True- (<=) _ _ = False+#if MIN_VERSION_template_haskell(2,4,0) && !(MIN_VERSION_template_haskell(2,8,0))+deriving instance Ord InlineSpec+deriving instance Ord Kind+#endif +#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0))+deriving instance Eq ClassInstance+deriving instance Ord ClassInstance+#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+#endif+++-- Orphan Ppr instances -- TODO: make this better instance Ppr Loc where ppr = showtextl . show@@ -66,6 +91,12 @@ instance Ppr Lit where ppr l = ppr (LitE l) +-- Orphan Lift instances (for when your TH generates TH!)+-- TODO: Shouldn't this have explicit type signatures?+-- This follows the pattern of the Lift instances for Int / Integer.+instance Lift Word8 where+ lift w = [e| fromIntegral $(lift (fromIntegral w :: Int)) |]+ $(deriveLiftMany [ ''Body , ''Callconv , ''Clause@@ -86,16 +117,29 @@ , ''Stmt , ''Strict , ''Type+ #if MIN_VERSION_template_haskell(2,4,0) , ''FamFlavour- , ''InlineSpec- , ''Kind , ''Pragma , ''Pred , ''TyVarBndr+#endif+ #if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) , ''ClassInstance-#endif /* MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) */-#endif /* MIN_VERSION_template_haskell(2,4,0) */+#endif++#if MIN_VERSION_template_haskell(2,4,0) && !(MIN_VERSION_template_haskell(2,8,0))+ , ''InlineSpec+ , ''Kind+#endif++#if MIN_VERSION_template_haskell(2,8,0)+ , ''Inline+ , ''Phases + , ''RuleBndr+ , ''RuleMatch+ , ''TyLit+#endif ])
th-orphans.cabal view
@@ -1,5 +1,5 @@ name: th-orphans-version: 0.5.2.0+version: 0.6 cabal-version: >= 1.6 build-type: Simple license: BSD3@@ -12,10 +12,13 @@ stability: experimental tested-with: GHC == 6.12.3, GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.1 synopsis: Orphan instances for TH datatypes-description: In particular, instances for Ord and Lift.+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. library- build-depends: base >= 4.2 && < 4.6,+ build-depends: base >= 4.2 && < 4.7, th-lift == 0.5.* if impl(ghc >= 7.4)