packages feed

lens-family-core 2.0.0 → 2.1.3

raw patch · 5 files changed

Files

CHANGELOG view
@@ -1,3 +1,21 @@+2.1.3 (Changes from 2.1.2)+=========================+* Bump dependency on containers.++2.1.2 (Changes from 2.1.0)+==========================+* Bump dependency on transformers.++2.1.0 (Changes from 2.0.0)+==========================+This release makes some minor name changes to functions.++* 'lft' and 'rgt' have been renamed as 'left' and 'right'.+* 'some' and 'none' have been renamed as 'just' and 'nothing'.+* Similar name changes for the lens variants of the above prisms.++The old names are depricated and may be removed in the future.+ 2.0.0 (Changes from 1.2.4) ========================== This new release continues to explore the design of Van Laarhoven style
lens-family-core.cabal view
@@ -1,11 +1,11 @@ name:               lens-family-core category:           Data, Lenses-version:            2.0.0+version:            2.1.3 license:            BSD3-cabal-version:      >= 1.6+cabal-version:      >= 1.10 license-file:       LICENSE author:             Russell O'Connor-maintainer:         Russell O'Connor <roconnor@theorem.ca>+maintainer:         Russell O'Connor <roconnor@r6.ca> stability:          experimental copyright:          Copyright (C) 2012,2013,2014,2017,2018,2019 Russell O'Connor synopsis:           Haskell 2022 Lens Families@@ -43,10 +43,11 @@   location: https://hub.darcs.net/roconnor/lens-family  library+  default-language:   Haskell2010   build-depends:     base                 >= 4.11    && < 5,-    containers           >= 0.5.8   && < 0.7,-    transformers         >= 0.3.0   && < 0.6+    containers           >= 0.5.8   && < 0.8,+    transformers         >= 0.3.0   && < 0.7    exposed-modules:     Lens.Family.Unchecked
src/Lens/Family.hs view
@@ -68,7 +68,7 @@ -- -- | 'zipWithOf' can be used with grates to zip two structure together provided a binary operation. ----- 'under' can be to modify each value in a structure according to a function.  This works analogous to how 'over' works for lenses and traversals.+-- 'under' can be used to modify each value in a structure according to a function.  This works analogous to how 'over' works for lenses and traversals. -- -- 'review' can be used with grates to construct a constant grate from a single value.  This is like a 0-ary @zipWith@ function. --
src/Lens/Family/Stock.hs view
@@ -12,8 +12,8 @@   , at', intAt'   , contains, intContains -- * Stock Prisms-  , lft, rgt-  , some, none+  , left, right+  , just, nothing -- * Stock Grids   , both   , bend, lend@@ -24,8 +24,8 @@ -- * Stock Traversals   , both_   , bend_, lend_-  , lft_, rgt_-  , some_, none_+  , left_, right_+  , just_, nothing_   , ignored -- * Stock SECs   , mapped@@ -44,6 +44,11 @@   , GrateLike, GrateLike'   , Identical, Backwards   , FiniteBits+-- * Deprecated names+  , lft, rgt+  , some, none+  , lft_, rgt_+  , some_, none_   ) where  import Control.Arrow (first, second)@@ -174,79 +179,79 @@ -- A grate accessing the codomain of a function. cod f h r = f $ ($ r) <$> h -lft :: (Applicative f, Traversable g) => AdapterLike f g (Either a r) (Either b r) a b+left :: (Applicative f, Traversable g) => AdapterLike f g (Either a r) (Either b r) a b -- ^ @--- lft :: Prism (Either a r) (Either b r) a b+-- left :: Prism (Either a r) (Either b r) a b -- @ -- -- A prism on the 'Left' element of an 'Either'.-lft f = either (pure . Right) (fmap Left . f) . traverse switch+left f = either (pure . Right) (fmap Left . f) . traverse switch  where   switch = either Right Left -lft_ :: Applicative f => LensLike f (Either a r) (Either b r) a b+left_ :: Applicative f => LensLike f (Either a r) (Either b r) a b -- ^ @--- lft_ :: Traversal (Either a r) (Either b r) a b+-- left_ :: Traversal (Either a r) (Either b r) a b -- @ -- -- Traversal on the 'Left' element of an 'Either'. -- -- @--- lft_ = under lft+-- left_ = under left -- @-lft_ = under lft+left_ = under left -rgt :: (Applicative f, Traversable g) => AdapterLike f g (Either r a) (Either r b) a b+right :: (Applicative f, Traversable g) => AdapterLike f g (Either r a) (Either r b) a b -- ^ @--- rgt :: Prism (Either r a) (Either r b) a b+-- right :: Prism (Either r a) (Either r b) a b -- @ -- -- A prism on the 'Right' element of an 'Either'.-rgt f = either (pure . Left) (fmap Right . f) . sequenceA+right f = either (pure . Left) (fmap Right . f) . sequenceA -rgt_ :: Applicative f => LensLike f (Either r a) (Either r b) a b+right_ :: Applicative f => LensLike f (Either r a) (Either r b) a b -- ^ @--- rgt_ :: Traversal (Either r a) (Either r b) a b+-- right_ :: Traversal (Either r a) (Either r b) a b -- @ -- -- Traversal on the 'Right' element of an 'Either'. -- -- @--- rgt_ = under rgt+-- right_ = under right -- @-rgt_ = under rgt+right_ = under right -some :: (Applicative f, Traversable g) => AdapterLike f g (Maybe a) (Maybe b) a b+just :: (Applicative f, Traversable g) => AdapterLike f g (Maybe a) (Maybe b) a b -- ^ @--- some :: Prism (Maybe a) (Maybe b) a b+-- just :: Prism (Maybe a) (Maybe b) a b -- @ -- -- A prism on the 'Just' element of a 'Maybe'.-some f = maybe (pure Nothing) (fmap Just . f) . sequenceA+just f = maybe (pure Nothing) (fmap Just . f) . sequenceA -some_ :: Applicative f => LensLike f (Maybe a) (Maybe b) a b+just_ :: Applicative f => LensLike f (Maybe a) (Maybe b) a b -- ^ @--- some_ :: Traversal (Maybe a) (Maybe b) a b+-- just_ :: Traversal (Maybe a) (Maybe b) a b -- @ -- -- Traversal on the 'Just' element of a 'Maybe'.-some_ = under some+just_ = under just -none :: (Applicative f, Traversable g) => AdapterLike' f g (Maybe a) ()+nothing :: (Applicative f, Traversable g) => AdapterLike' f g (Maybe a) () -- ^ @--- none :: Prism' (Maybe a) ()+-- nothing :: Prism' (Maybe a) () -- @ -- -- A prism on the 'Nothing' element of a 'Maybe'.-none = prism (maybe (Right ()) (Left . Just)) (const Nothing)+nothing = prism (maybe (Right ()) (Left . Just)) (const Nothing) -none_ :: Applicative f => LensLike' f (Maybe a) ()+nothing_ :: Applicative f => LensLike' f (Maybe a) () -- ^ @--- none_ :: Traversal' (Maybe a) ()+-- nothing_ :: Traversal' (Maybe a) () -- @ -- -- Traversal on the 'Nothing' element of a 'Maybe'.-none_ = under none+nothing_ = under nothing  both :: (Applicative f, Functor g) => AdapterLike f g (a,a) (b,b) a b -- ^ @@@ -503,3 +508,35 @@ from l = l'  where   FromF l' = l (\(FromG h1) -> FromF $ (.) h1) (FromG id)++{-# DEPRECATED lft "Renamed as 'left'." #-}+lft :: (Applicative f, Traversable g) => AdapterLike f g (Either a r) (Either b r) a b+lft = left++{-# DEPRECATED lft_ "Renamed as 'left_'." #-}+lft_ :: Applicative f => LensLike f (Either a r) (Either b r) a b+lft_ = left_++{-# DEPRECATED rgt "Renamed as 'right'." #-}+rgt :: (Applicative f, Traversable g) => AdapterLike f g (Either r a) (Either r b) a b+rgt = right++{-# DEPRECATED rgt_ "Renamed as 'right_'." #-}+rgt_ :: Applicative f => LensLike f (Either r a) (Either r b) a b+rgt_ = right_++{-# DEPRECATED some "Renamed as 'just'." #-}+some :: (Applicative f, Traversable g) => AdapterLike f g (Maybe a) (Maybe b) a b+some = just++{-# DEPRECATED some_ "Renamed as 'just_'." #-}+some_ :: Applicative f => LensLike f (Maybe a) (Maybe b) a b+some_ = just_++{-# DEPRECATED none "Renamed as 'nothing'." #-}+none :: (Applicative f, Traversable g) => AdapterLike' f g (Maybe a) ()+none = nothing++{-# DEPRECATED none_ "Renamed as 'nothing_'." #-}+none_ :: Applicative f => LensLike' f (Maybe a) ()+none_ = nothing_
src/Lens/Family/Unchecked.hs view
@@ -147,7 +147,7 @@ -- -- /Note/: It is possible to build grates without even depending on @lens-family-core@ by expanding away the type synonym. ----- > myStream :: Functor g => (g (Stream a) -> Stream b) -> g a -> b+-- > myStream :: Functor g => (g a -> b) -> g (Stream a) -> Stream b -- -- Any value @t :: Functor g => GrateLike g s t a b@ is a well-defined grate when it satisfies the two van Laarhoven traversal laws: --