focus 0.1.1 → 0.1.2
raw patch · 3 files changed
+13/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- focus.cabal +1/−1
- library/Focus.hs +12/−0
- library/Focus/Prelude.hs +0/−1
focus.cabal view
@@ -1,7 +1,7 @@ name: focus version:- 0.1.1+ 0.1.2 synopsis: A general abstraction for manipulating elements of container data structures description:
library/Focus.hs view
@@ -32,36 +32,42 @@ -- | -- Reproduces the behaviour of -- @Data.Map.<http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Map-Lazy.html#v:adjust adjust>@.+{-# INLINE adjust #-} adjust :: (a -> a) -> Strategy a () adjust f = maybe ((), Keep) (\a -> ((), Replace (f a))) -- | -- Reproduces the behaviour of -- @Data.Map.<http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Map-Lazy.html#v:update update>@.+{-# INLINE update #-} update :: (a -> Maybe a) -> Strategy a () update f = maybe ((), Keep) (\a -> ((), maybe Remove Replace (f a))) -- | -- Reproduces the behaviour of -- @Data.Map.<http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Map-Lazy.html#v:alter alter>@.+{-# INLINE alter #-} alter :: (Maybe a -> Maybe a) -> Strategy a () alter f = ((),) . maybe Remove Replace . f -- | -- Reproduces the behaviour of -- @Data.Map.<http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Map-Lazy.html#v:insert insert>@.+{-# INLINE insert #-} insert :: a -> Strategy a () insert a = const ((), Replace a) -- | -- Reproduces the behaviour of -- @Data.Map.<http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Map-Lazy.html#v:delete delete>@.+{-# INLINE delete #-} delete :: Strategy a () delete = const ((), Remove) -- | -- Reproduces the behaviour of -- @Data.Map.<http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Map-Lazy.html#v:lookup lookup>@.+{-# INLINE lookup #-} lookup :: Strategy a (Maybe a) lookup r = (r, Keep) @@ -71,31 +77,37 @@ -- | -- A monadic version of 'adjust'.+{-# INLINE adjustM #-} adjustM :: (Monad m) => (a -> m a) -> StrategyM m a () adjustM f = maybe (return ((), Keep)) (liftM (((),) . Replace) . f) -- | -- A monadic version of 'update'.+{-# INLINE updateM #-} updateM :: (Monad m) => (a -> m (Maybe a)) -> StrategyM m a () updateM f = maybe (return ((), Keep)) (liftM (((),) . maybe Remove Replace) . f) -- | -- A monadic version of 'alter'.+{-# INLINE alterM #-} alterM :: (Monad m) => (Maybe a -> m (Maybe a)) -> StrategyM m a () alterM f = liftM (((),) . maybe Remove Replace) . f -- | -- A monadic version of 'insert'.+{-# INLINE insertM #-} insertM :: (Monad m) => a -> StrategyM m a () insertM = fmap return . insert -- | -- A monadic version of 'delete'.+{-# INLINE deleteM #-} deleteM :: (Monad m) => StrategyM m a () deleteM = fmap return delete -- | -- A monadic version of 'lookup'.+{-# INLINE lookupM #-} lookupM :: (Monad m) => StrategyM m a (Maybe a) lookupM = fmap return lookup
library/Focus/Prelude.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} module Focus.Prelude ( module Exports,