strict-base-types 0.2.1 → 0.2.2
raw patch · 2 files changed
+17/−2 lines, 2 filesdep ~lens
Dependency ranges changed: lens
Files
- src/Data/Tuple/Strict.hs +15/−0
- strict-base-types.cabal +2/−2
src/Data/Tuple/Strict.hs view
@@ -41,7 +41,14 @@ import Control.Applicative (Applicative ((<*>)), (<$>)) import Control.DeepSeq (NFData (..))++#if MIN_VERSION_lens(4,0,0)+import Control.Lens.At (Index)+import Control.Lens.Each (Each(..))+#else import Control.Lens.Each (Index, Each(..))+#endif+ import Control.Lens.Iso (Strict (..), Swapped (..), iso) import Control.Lens.Indexed (indexed) import Control.Lens.Operators ((<&>))@@ -134,10 +141,18 @@ instance Swapped Pair where swapped = iso swap swap + type instance Index (Pair a b) = Int +#if MIN_VERSION_lens(4,0,0)+instance (a~a', b~b') => Each (Pair a a') (Pair b b') a b where+ each f ~(a :!: b) = (:!:) <$> f a <*> f b+ {-# INLINE each #-}+#else instance (Applicative f, a~a', b~b') => Each f (Pair a a') (Pair b b') a b where each f (a :!: b) = (:!:) <$> indexed f (0::Int) a <*> indexed f (1::Int) b+ {-# INLINE each #-}+#endif {- To be added once they make it to base
strict-base-types.cabal view
@@ -1,5 +1,5 @@ Name: strict-base-types-Version: 0.2.1+Version: 0.2.2 Synopsis: Strict variants of the types provided in base. Category: Data Description:@@ -96,7 +96,7 @@ Simon Meier <iridcode@gmail.com> Maintainer: Simon Meier <iridcode@gmail.com> Copyright: (c) 2006-2008 by Roman Leshchinskiy- (c) 2013 by Simon Meier+ (c) 2013-2014 by Simon Meier Homepage: https://github.com/meiersi/strict-base-types Cabal-Version: >= 1.6 Build-type: Simple