validation 1.2.0 → 1.2.1
raw patch · 2 files changed
+42/−14 lines, 2 files
Files
- changelog +4/−0
- validation.cabal +38/−14
changelog view
@@ -1,3 +1,7 @@+1.2.1++* Updates to documentation.+ 1.2.0 * Add Validator e p x a profunctor transformer newtype with instances
validation.cabal view
@@ -1,5 +1,5 @@ name: validation-version: 1.2.0+version: 1.2.1 license: BSD3 license-file: LICENCE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>, Nick Partridge <nkpart>@@ -13,30 +13,53 @@ description: <<https://logo.systemf.com.au/systemf-450x450.png>> .- A data-type like Either but with differing properties and type-class- instances.- .- Library support is provided for this different representation, include- `lens`-related functions for converting between each and abstracting over their- similarities.+ A data type like @Either@ but with an accumulating @Applicative@ instance. .- * `Validation`+ == @Validation@ .- The `Validation` data type is isomorphic to `Either`, but has an instance- of `Applicative` that accumulates on the error side. That is to say, if two- (or more) errors are encountered, they are appended using a `Semigroup`+ The @Validation@ data type is isomorphic to @Either@, but has an instance+ of @Applicative@ that accumulates on the error side. That is to say, if two+ (or more) errors are encountered, they are appended using a @Semigroup@ operation. .- As a consequence of this `Applicative` instance, there is no corresponding- `Bind` or `Monad` instance. `Validation` is an example of, "An applicative+ As a consequence of this @Applicative@ instance, there is no corresponding+ @Bind@ or @Monad@ instance. @Validation@ is an example of, "An applicative functor that is not a monad."+ .+ The library provides:+ .+ * Classy optics (@GetValidation@, @HasValidation@, @ReviewValidation@,+ @AsValidation@, and corresponding classes for @Failure@ and @Success@)+ following the conventions of @makeClassy@ and @makeClassyPrisms@ from @lens@.+ * Polymorphic prisms (@__Failure@, @__Success@) for type-changing operations.+ * Isomorphisms to @Either@ and @(Bool, a)@.+ .+ == @Validator@+ .+ The @Validator@ newtype is a profunctor transformer:+ .+ @newtype Validator e p x a = Validator (p x (Validation e a))@+ .+ @Validator e (->) x a@ is isomorphic to @x -> Validation e a@. The profunctor+ parameter @p@ generalises this to other optic-like contexts such as @Tagged@,+ @Iso@, and @Prism@.+ .+ Instances include @Functor@, @Apply@, @Applicative@, @Alt@, @Selective@,+ @Profunctor@, @Strong@, @Choice@, @Semigroupoid@, @Category@, @Arrow@,+ @ArrowApply@, @ArrowChoice@, and @Wrapped@.+ .+ The @Applicative@ instance accumulates errors in parallel (using @Semigroup@),+ while @Category@ composition short-circuits on @Failure@ (like monadic bind).+ .+ The library also provides profunctor newtype wrappers (@Iso''@, @Prism''@) that+ allow @Validator@ to be parameterised over monomorphic isos and prisms. homepage: https://github.com/system-f/validation bug-reports: https://github.com/system-f/validation/issues cabal-version: >= 1.10 build-type: Simple extra-source-files: changelog-tested-with: GHC==9.0.1, GHC==8.10.4, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4+tested-with: GHC == 9.10.3, GHC == 9.8.4, GHC == 9.6.7, GHC==9.0.1, GHC==8.10.4, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4 source-repository head type: git@@ -107,6 +130,7 @@ build-depends: base >= 4.11 && < 5 , process >= 1.6 && < 2+ , validation ghc-options: -Wall