fclabels 1.1.1.1 → 1.1.2
raw patch · 4 files changed
+48/−33 lines, 4 filesdep ~transformersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: transformers
API changes (from Hackage documentation)
+ Data.Label.Maybe: modify' :: (f :~> a) -> (a -> a) -> f -> f
+ Data.Label.Maybe: set' :: (f :~> a) -> a -> f -> f
Files
- LICENCE +0/−28
- LICENSE +28/−0
- fclabels.cabal +6/−5
- src/Data/Label/Maybe.hs +14/−0
− LICENCE
@@ -1,28 +0,0 @@-Copyright (c) Erik Hesselink & Sebastiaan Visser 2008--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions-are met:-1. Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-2. Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in the- documentation and/or other materials provided with the distribution.-3. Neither the name of the author nor the names of his contributors- may be used to endorse or promote products derived from this software- without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF-SUCH DAMAGE.-
+ LICENSE view
@@ -0,0 +1,28 @@+Copyright (c) Erik Hesselink & Sebastiaan Visser 2008++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.+
fclabels.cabal view
@@ -1,5 +1,5 @@ Name: fclabels-Version: 1.1.1.1+Version: 1.1.2 Author: Sebastiaan Visser, Erik Hesselink, Chris Eidhof, Sjoerd Visscher with lots of help and feedback from others. Synopsis: First class accessor labels.@@ -20,12 +20,13 @@ . See the "Data.Label.Maybe" module for the use of partial labels. .- > 1.1.1.0 -> 1.1.1.1- > - Relax dependency on transformers to include 0.3.0.0.+ > 1.1.1.0 -> 1.1.2+ > - Added partial set/modify versions that act as identity+ > when the constructor field is not available. Maintainer: Sebastiaan Visser <code@fvisser.nl> License: BSD3-License-File: LICENCE+License-File: LICENSE Category: Data Cabal-Version: >= 1.6 Build-Type: Simple@@ -48,7 +49,7 @@ base < 5 , template-haskell >= 2.2 && < 2.8 , mtl >= 1.0 && < 2.2- , transformers >= 0.2 && < 0.4+ , transformers >= 0.2 && < 0.3 Source-Repository head Type: git
src/Data/Label/Maybe.hs view
@@ -4,7 +4,9 @@ , lens , get , set+, set' , modify+, modify' , embed ) where@@ -47,11 +49,23 @@ set :: f :~> a -> a -> f -> Maybe f set l v = run (A.set l . arr (v,)) +-- | Like 'set' but return behaves like the identity function when the field+-- could not be set.++set' :: (f :~> a) -> a -> f -> f+set' l v f = f `fromMaybe` set l v f+ -- | Modifier for a lens that can fail. When the field to which the lens points -- is not accessible this function returns 'Nothing'. modify :: (f :~> a) -> (a -> a) -> f -> Maybe f modify l m = run (A.modify l . arr (arr m,))++-- | Like 'modify' but return behaves like the identity function when the field+-- could not be set.++modify' :: (f :~> a) -> (a -> a) -> f -> f+modify' l m f = f `fromMaybe` modify l m f -- | Embed a pure lens that points to a `Maybe` field into a lens that might -- fail.