Compatibility with lens 4.0
bartavelle opened this issue · comments
I would like to upgrade some of my libraries to latest lens, but strict-base-types doesn't seem to build against it :
cabal install -p
Resolving dependencies...
Configuring strict-base-types-0.2.1...
Building strict-base-types-0.2.1...
Preprocessing library strict-base-types-0.2.1...
[1 of 3] Compiling Data.Either.Strict ( src/Data/Either/Strict.hs, dist/build/Data/Either/Strict.o )
[2 of 3] Compiling Data.Maybe.Strict ( src/Data/Maybe/Strict.hs, dist/build/Data/Maybe/Strict.o )
[3 of 3] Compiling Data.Tuple.Strict ( src/Data/Tuple/Strict.hs, dist/build/Data/Tuple/Strict.o )
src/Data/Tuple/Strict.hs:44:39:
Module `Control.Lens.Each' does not export `Index'
Failed to install strict-base-types-0.2.1
cabal: Error: some packages failed to install:
filecache-0.2.2 depends on strict-base-types-0.2.1 which failed to install.
strict-base-types-0.2.1 failed during the building phase. The exception was:
ExitFailure 1
The following change seems to let the module compile :
diff -ruN strict-base-types-0.2.1/src/Data/Tuple/Strict.hs strict-base-types-0.2.1-btvl/src/Data/Tuple/Strict.hs
--- strict-base-types-0.2.1/src/Data/Tuple/Strict.hs 2014-01-30 15:11:35.664525001 +0100
+++ strict-base-types-0.2.1-btvl/src/Data/Tuple/Strict.hs 2014-01-30 15:05:46.096537104 +0100
@@ -41,7 +41,8 @@
import Control.Applicative (Applicative ((<*>)), (<$>))
import Control.DeepSeq (NFData (..))
-import Control.Lens.Each (Index, Each(..))
+import Control.Lens.Each (Each(..))
+import Control.Lens.At (Index)
import Control.Lens.Iso (Strict (..), Swapped (..), iso)
import Control.Lens.Indexed (indexed)
import Control.Lens.Operators ((<&>))
@@ -136,7 +137,7 @@
type instance Index (Pair a b) = Int
-instance (Applicative f, a~a', b~b') => Each f (Pair a a') (Pair b b') a b where
+instance (Applicative f, a~a', b~b') => Each (Pair a a') (Pair b b') a b where
each f (a :!: b) = (:!:) <$> indexed f (0::Int) a <*> indexed f (1::Int) b
{- To be added once they make it to base
Thanks for the report. I've used some CPP hackery to make it compile both with lens < 4.0 and lens >= 4.0. Avaliable as http://hackage.haskell.org/package/strict-base-types-0.2.2.