--- Begin Message ---
Package: haskell-lens
Severity: normal
Version: 3.9.0.2
Tags: patch
Lens FTBFS on arches without TH, but the template haskell is only used
for deriving lenses for records (and some dependencies of error lenses).
Lens is otherwise useable on those arches. For example, code might only
want to use a lens into tuples, or maps, or any of the many other
provided lenses. Or a package that does need record lenses could be
fixed to build on all arches rather simply by pasting in the boilerplate
getters and setters, and could then use the rest of lens.
I have been avoiding using lens for some time because of this
portability problem. But it strikes me that the rest of the haskell
community is not likely to do that, and it seems to be getting more
widely used. So I think Debian should consider modifying lens to build
without TH on arches that lack it.
The modifications turn out to be fairly reasonable. Patches attached.
There is a risk that some package that currently builds on arches
without TH currently tests that lens is not available, and avoids using
Control.Lens.TH. With this patch, such a test would be defeated, and the
package's build would be broken. I feel this is an fairly unlikely
scenario, and one that would be quickly caught in the regular haskell
package rebuild cycle, and would be easily fixed.
--
see shy jo
From 04510ab1a91ec7445b9575e9cb7fda3be94b2b2c Mon Sep 17 00:00:00 2001
From: Joey Hess <j...@kitenet.net>
Date: Sun, 13 Oct 2013 01:55:21 -0400
Subject: [PATCH 1/3] remove hlint ANNotations
These prevent building on systems without ghci.
---
debian/control | 7 +++----
src/Control/Exception/Lens.hs | 2 --
src/Control/Lens.hs | 1 -
src/Control/Lens/Equality.hs | 3 ---
src/Control/Lens/Fold.hs | 4 ----
src/Control/Lens/Internal.hs | 1 -
src/Control/Lens/Internal/Zipper.hs | 1 -
src/Control/Lens/Iso.hs | 1 -
src/Control/Lens/Lens.hs | 2 --
src/Control/Lens/Operators.hs | 1 -
src/Control/Lens/Plated.hs | 1 -
src/Control/Lens/Prism.hs | 1 -
src/Control/Lens/Setter.hs | 1 -
src/Data/Data/Lens.hs | 3 ---
14 files changed, 3 insertions(+), 26 deletions(-)
diff --git a/debian/control b/debian/control
index 83af3b0..364ee63 100644
--- a/debian/control
+++ b/debian/control
@@ -26,9 +26,9 @@ Build-Depends: debhelper (>= 9)
, libghc-distributive-dev (>> 0.3)
, libghc-distributive-dev (<< 1)
, libghc-distributive-prof
- , libghc-generic-deriving-dev (>> 1.4)
- , libghc-generic-deriving-dev (<< 1.6)
- , libghc-generic-deriving-prof
+ , libghc-generic-deriving-dev (>> 1.4) [!armel]
+ , libghc-generic-deriving-dev (<< 1.6) [!armel]
+ , libghc-generic-deriving-prof [!armel]
, libghc-hashable-dev (>> 1.1.2.3)
, libghc-hashable-dev (<< 1.3)
, libghc-hashable-prof
@@ -62,7 +62,6 @@ Build-Depends: debhelper (>= 9)
, libghc-tagged-dev (>> 0.4.4)
, libghc-tagged-dev (<< 1)
, libghc-tagged-prof
- , ghc-ghci
, libghc-text-dev (>> 0.11)
, libghc-text-dev (<< 0.12)
, libghc-text-prof
diff --git a/src/Control/Exception/Lens.hs b/src/Control/Exception/Lens.hs
index 4bc3926..34b46ff 100644
--- a/src/Control/Exception/Lens.hs
+++ b/src/Control/Exception/Lens.hs
@@ -112,8 +112,6 @@ import Prelude
, Maybe(..), Either(..), Functor(..), String, IO
)
-{-# ANN module "HLint: ignore Use Control.Exception.catch" #-}
-
-- $setup
-- >>> :set -XNoOverloadedStrings
-- >>> :m + Control.Exception Control.Monad Data.List Prelude
diff --git a/src/Control/Lens.hs b/src/Control/Lens.hs
index 242c3c1..c60cf91 100644
--- a/src/Control/Lens.hs
+++ b/src/Control/Lens.hs
@@ -99,4 +99,3 @@ import Control.Lens.Wrapped
import Control.Lens.Zipper
import Control.Lens.Zoom
-{-# ANN module "HLint: ignore Use import/export shortcut" #-}
diff --git a/src/Control/Lens/Equality.hs b/src/Control/Lens/Equality.hs
index 982c2d7..32c25c3 100644
--- a/src/Control/Lens/Equality.hs
+++ b/src/Control/Lens/Equality.hs
@@ -28,9 +28,6 @@ module Control.Lens.Equality
import Control.Lens.Internal.Setter
import Control.Lens.Type
-{-# ANN module "HLint: ignore Use id" #-}
-{-# ANN module "HLint: ignore Eta reduce" #-}
-
-- $setup
-- >>> import Control.Lens
diff --git a/src/Control/Lens/Fold.hs b/src/Control/Lens/Fold.hs
index 32a4073..aec2d4d 100644
--- a/src/Control/Lens/Fold.hs
+++ b/src/Control/Lens/Fold.hs
@@ -163,10 +163,6 @@ import Data.Traversable
-- >>> let g :: Expr -> Expr; g = Debug.SimpleReflect.Vars.g
-- >>> let timingOut :: NFData a => a -> IO a; timingOut = fmap (fromMaybe (error "timeout")) . timeout (5*10^6) . evaluate . force
-{-# ANN module "HLint: ignore Eta reduce" #-}
-{-# ANN module "HLint: ignore Use camelCase" #-}
-{-# ANN module "HLint: ignore Use curry" #-}
-
infixl 8 ^.., ^?, ^?!, ^@.., ^@?, ^@?!
--------------------------
diff --git a/src/Control/Lens/Internal.hs b/src/Control/Lens/Internal.hs
index 295662e..7b30335 100644
--- a/src/Control/Lens/Internal.hs
+++ b/src/Control/Lens/Internal.hs
@@ -43,4 +43,3 @@ import Control.Lens.Internal.Review
import Control.Lens.Internal.Setter
import Control.Lens.Internal.Zoom
-{-# ANN module "HLint: ignore Use import/export shortcut" #-}
diff --git a/src/Control/Lens/Internal/Zipper.hs b/src/Control/Lens/Internal/Zipper.hs
index 95875b7..9139d18 100644
--- a/src/Control/Lens/Internal/Zipper.hs
+++ b/src/Control/Lens/Internal/Zipper.hs
@@ -53,7 +53,6 @@ import Data.Profunctor.Unsafe
-- >>> import Control.Lens
-- >>> import Data.Char
-{-# ANN module "HLint: ignore Use foldl" #-}
------------------------------------------------------------------------------
-- * Jacket
diff --git a/src/Control/Lens/Iso.hs b/src/Control/Lens/Iso.hs
index 1152af4..5b680ec 100644
--- a/src/Control/Lens/Iso.hs
+++ b/src/Control/Lens/Iso.hs
@@ -82,7 +82,6 @@ import Data.Maybe
import Data.Profunctor
import Data.Profunctor.Unsafe
-{-# ANN module "HLint: ignore Use on" #-}
-- $setup
-- >>> :set -XNoOverloadedStrings
diff --git a/src/Control/Lens/Lens.hs b/src/Control/Lens/Lens.hs
index b26cc06..cf8d688 100644
--- a/src/Control/Lens/Lens.hs
+++ b/src/Control/Lens/Lens.hs
@@ -126,8 +126,6 @@ import Data.Profunctor.Rep
import Data.Profunctor.Unsafe
import Data.Void
-{-# ANN module "HLint: ignore Use ***" #-}
-
-- $setup
-- >>> :set -XNoOverloadedStrings
-- >>> import Control.Lens
diff --git a/src/Control/Lens/Operators.hs b/src/Control/Lens/Operators.hs
index 11868e0..4e77cd0 100644
--- a/src/Control/Lens/Operators.hs
+++ b/src/Control/Lens/Operators.hs
@@ -108,4 +108,3 @@ import Control.Lens.Review
import Control.Lens.Setter
import Control.Lens.Zipper
-{-# ANN module "HLint: ignore Use import/export shortcut" #-}
diff --git a/src/Control/Lens/Plated.hs b/src/Control/Lens/Plated.hs
index a8c4d20..e6b8dea 100644
--- a/src/Control/Lens/Plated.hs
+++ b/src/Control/Lens/Plated.hs
@@ -95,7 +95,6 @@ import Data.Data.Lens
import Data.Monoid
import Data.Tree
-{-# ANN module "HLint: ignore Reduce duplication" #-}
-- | A 'Plated' type is one where we know how to extract its immediate self-similar children.
--
diff --git a/src/Control/Lens/Prism.hs b/src/Control/Lens/Prism.hs
index 0f3253f..e60a884 100644
--- a/src/Control/Lens/Prism.hs
+++ b/src/Control/Lens/Prism.hs
@@ -51,7 +51,6 @@ import Data.Void
import Unsafe.Coerce
#endif
-{-# ANN module "HLint: ignore Use camelCase" #-}
-- $setup
-- >>> :set -XNoOverloadedStrings
diff --git a/src/Control/Lens/Setter.hs b/src/Control/Lens/Setter.hs
index a1e953f..d9f5b73 100644
--- a/src/Control/Lens/Setter.hs
+++ b/src/Control/Lens/Setter.hs
@@ -87,7 +87,6 @@ import Data.Profunctor
import Data.Profunctor.Rep
import Data.Profunctor.Unsafe
-{-# ANN module "HLint: ignore Avoid lambda" #-}
-- $setup
-- >>> import Control.Lens
diff --git a/src/Data/Data/Lens.hs b/src/Data/Data/Lens.hs
index cf1e7c9..fdb0e8f 100644
--- a/src/Data/Data/Lens.hs
+++ b/src/Data/Data/Lens.hs
@@ -65,9 +65,6 @@ import Data.Monoid
import GHC.Exts (realWorld#)
#endif
-{-# ANN module "HLint: ignore Eta reduce" #-}
-{-# ANN module "HLint: ignore Use foldl" #-}
-{-# ANN module "HLint: ignore Reduce duplication" #-}
-- $setup
-- >>> :set -XNoOverloadedStrings
--
1.7.10.4
From 88646e0992887d03b01407cf585818a35143558c Mon Sep 17 00:00:00 2001
From: Joey Hess <j...@kitenet.net>
Date: Mon, 14 Oct 2013 23:43:12 -0400
Subject: [PATCH 2/3] packaging changes
---
debian/control | 14 +++++++-------
debian/rules | 5 +++++
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/debian/control b/debian/control
index 364ee63..fa467a6 100644
--- a/debian/control
+++ b/debian/control
@@ -26,9 +26,9 @@ Build-Depends: debhelper (>= 9)
, libghc-distributive-dev (>> 0.3)
, libghc-distributive-dev (<< 1)
, libghc-distributive-prof
- , libghc-generic-deriving-dev (>> 1.4) [!armel]
- , libghc-generic-deriving-dev (<< 1.6) [!armel]
- , libghc-generic-deriving-prof [!armel]
+ , libghc-generic-deriving-dev (>> 1.4) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-generic-deriving-dev (<< 1.6) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-generic-deriving-prof [!armel !armhf !mips !mipsel !s390 !s390x]
, libghc-hashable-dev (>> 1.1.2.3)
, libghc-hashable-dev (<< 1.3)
, libghc-hashable-prof
@@ -47,9 +47,9 @@ Build-Depends: debhelper (>= 9)
, libghc-profunctors-dev (>> 3.2)
, libghc-profunctors-dev (<< 4)
, libghc-profunctors-prof
- , libghc-reflection-dev (>> 1.1.6)
- , libghc-reflection-dev (<< 2)
- , libghc-reflection-prof
+ , libghc-reflection-dev (>> 1.1.6) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-reflection-dev (<< 2) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-reflection-prof [!armel !armhf !mips !mipsel !s390 !s390x]
, libghc-semigroupoids-dev (>> 3.0.2)
, libghc-semigroupoids-dev (<< 4)
, libghc-semigroupoids-prof
@@ -82,7 +82,7 @@ Build-Depends: debhelper (>= 9)
, libghc-test-framework-dev (>> 0.6)
, libghc-test-framework-quickcheck2-dev (>> 0.2)
, libghc-test-framework-hunit-dev (>> 0.2)
- , libghc-test-framework-th-dev (>> 0.2)
+ , libghc-test-framework-th-dev (>> 0.2) [!armel !armhf !mips !mipsel !s390 !s390x]
, libghc-doctest-dev (>> 0.9.1)
, libghc-simple-reflect-dev (>> 0.3.1)
Build-Depends-Indep: ghc-doc
diff --git a/debian/rules b/debian/rules
index 8ec1809..8ad7013 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,3 +10,8 @@ ifeq ($(DEB_HOST_ARCH),sparc)
# Disable tests that require SMP.
DEB_SETUP_GHC_CONFIGURE_ARGS := -f-test-hunit -f-test-properties
endif
+
+ifeq ($(shell if [ ! -e /usr/bin/ghci ]; then echo 0; fi),0)
+ DEB_SETUP_GHC_CONFIGURE_ARGS := -fwithout-th -f-test-hunit -f-test-properties -f-test-doctests
+endif
+
--
1.7.10.4
From 6db5884760a02adc15e5777a675c32a7ab926b8b Mon Sep 17 00:00:00 2001
From: Joey Hess <j...@kitenet.net>
Date: Mon, 14 Oct 2013 23:43:57 -0400
Subject: [PATCH 3/3] add without-th flag
---
lens.cabal | 28 +++++++++++++++++++++-------
src/Control/Lens/Internal/Exception.hs | 6 ++++++
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/lens.cabal b/lens.cabal
index 8714cdd..7c31cab 100644
--- a/lens.cabal
+++ b/lens.cabal
@@ -133,6 +133,11 @@ flag dump-splices
default: False
manual: True
+-- Avoid bulding modules that need TH
+flag without-th
+ default: False
+ manual: True
+
-- You can disable the doctests test suite with -f-test-doctests
flag test-doctests
default: True
@@ -175,7 +180,6 @@ library
containers >= 0.4.0 && < 0.6,
distributive >= 0.3 && < 1,
filepath >= 1.2.0.0 && < 1.4,
- generic-deriving >= 1.4 && < 1.6,
ghc-prim,
hashable >= 1.1.2.3 && < 1.3,
MonadCatchIO-transformers >= 0.3 && < 0.4,
@@ -183,7 +187,6 @@ library
parallel >= 3.1.0.1 && < 3.3,
profunctors >= 3.2 && < 4,
profunctor-extras >= 3.3 && < 4,
- reflection >= 1.1.6 && < 2,
semigroupoids >= 3.0.2 && < 4,
semigroups >= 0.8.4 && < 1,
split == 0.2.*,
@@ -237,7 +240,6 @@ library
Control.Lens.Review
Control.Lens.Setter
Control.Lens.Simple
- Control.Lens.TH
Control.Lens.Traversal
Control.Lens.Tuple
Control.Lens.Type
@@ -268,14 +270,23 @@ library
Data.Typeable.Lens
Data.Vector.Lens
Data.Vector.Generic.Lens
- Generics.Deriving.Lens
- GHC.Generics.Lens
System.Exit.Lens
System.FilePath.Lens
- System.IO.Error.Lens
- Language.Haskell.TH.Lens
Numeric.Lens
+ if flag(without-th)
+ cpp-options: -DDISABLE_TEMPLATE_HASKELL
+ else
+ build-depends:
+ generic-deriving >= 1.4 && < 1.6,
+ reflection >= 1.1.6 && < 2
+ exposed-modules:
+ Control.Lens.TH
+ Language.Haskell.TH.Lens
+ Generics.Deriving.Lens
+ GHC.Generics.Lens
+ System.IO.Error.Lens
+
if flag(safe)
cpp-options: -DSAFE=1
@@ -308,6 +319,9 @@ test-suite templates
build-depends: base, lens
ghc-options: -Wall -threaded
hs-source-dirs: tests
+
+ if flag(without-th)
+ buildable: False
if flag(dump-splices)
ghc-options: -ddump-splices
diff --git a/src/Control/Lens/Internal/Exception.hs b/src/Control/Lens/Internal/Exception.hs
index 387203e..43a59fa 100644
--- a/src/Control/Lens/Internal/Exception.hs
+++ b/src/Control/Lens/Internal/Exception.hs
@@ -34,7 +34,9 @@ import Control.Monad.CatchIO as CatchIO
import Data.IORef
import Data.Monoid
import Data.Proxy
+#ifndef DISABLE_TEMPLATE_HASKELL
import Data.Reflection
+#endif
import Data.Typeable
import System.IO.Unsafe
@@ -128,6 +130,7 @@ class Handleable e (m :: * -> *) (h :: * -> *) | h -> e m where
handler_ l = handler l . const
{-# INLINE handler_ #-}
+#ifndef DISABLE_TEMPLATE_HASKELL
instance Handleable SomeException IO Exception.Handler where
handler = handlerIO
@@ -139,6 +142,7 @@ handlerIO l f = reify (preview l) $ \ (_ :: Proxy s) -> Exception.Handler (\(Han
handlerCatchIO :: forall m a r. Getting (First a) SomeException a -> (a -> m r) -> CatchIO.Handler m r
handlerCatchIO l f = reify (preview l) $ \ (_ :: Proxy s) -> CatchIO.Handler (\(Handling a :: Handling a s m) -> f a)
+#endif
------------------------------------------------------------------------------
-- Helpers
@@ -172,8 +176,10 @@ instance Show (Handling a s m) where
showsPrec d _ = showParen (d > 10) $ showString "Handling ..."
{-# INLINE showsPrec #-}
+#ifndef DISABLE_TEMPLATE_HASKELL
instance Reifies s (SomeException -> Maybe a) => Exception (Handling a s m) where
toException _ = SomeException HandlingException
{-# INLINE toException #-}
fromException = fmap Handling . reflect (Proxy :: Proxy s)
{-# INLINE fromException #-}
+#endif
--
1.7.10.4
signature.asc
Description: Digital signature
--- End Message ---