packages feed

valida-base 0.1.1 → 0.2.0

raw patch · 4 files changed

+15/−7 lines, 4 filesdep ~basedep ~smallcheckPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, smallcheck

API changes (from Hackage documentation)

+ Valida: infix 0 <??>
- Valida: infix 6 <??>
+ Valida: infix 6 <?>

Files

ChangeLog.md view
@@ -2,6 +2,12 @@ 
 ## Unreleased changes
 
+## 0.2.0
+* Change infix precedence of `<??>` from 6 to 0.
+* Allow `base` dependency to be 4.12 and above.
+* Constraint `smallcheck` dependency to be at least 1.2.0.
+* General additions and improvements to metadata.
+
 ## 0.1.1
 General fixes to metadata files.
 
README.md view
@@ -1,6 +1,8 @@ # Valida
 Simple, elegant, applicative validation for product types - batteries included!
 
+This is a dependency-less version of [valida](https://hackage.haskell.org/package/valida).
+
 Read the documentation on [hackage](https://hackage.haskell.org/package/valida-base).
 
 # Highlights
@@ -197,7 +199,7 @@ ## Wait, couldn't this be done using contravariant functors?
 Yes! The concept of *keeping the input of a `Validator`* set to the same product type, but *letting it validate a specific field* of said input, can be generalized to contravariant functors. The `Validator` type looks like- `Validator e inp a`, to keep applicative composition working, the `inp` needs to stay the same - but each validator within said composition should also be able to *consume* a specific part of the `inp`. `ValidationRule` itself, is the typical example of a contravariant functor as well. It's essentially a specialized predicate function- `a -> Validation e ()`. The `verify` function simply combines these 2 *potentially generalizable* contravariant functors, into a very specialized usecase.
 
-I do think adding instances for actual generalized contravariant functors/profunctors for `ValidationRule` and `Validator`, *could* be more powerful, while also being able to provide the same specialized functions. However, I've refrained from doing so as I didn't want to pull in the extra dependencies. I think the separation of `ValidationRule` and `Validator`, combined with the provided functions, *should* be able to reliably, and elegantly model any scenario of building a validator. I have yet to find a usecase where the generalized contravariant instances *would be significantly useful*. But it could certainly be more idiomatic for haskell. I may consider creating a package that *does* go the contravariant/profunctor route though.
+For a version of `Valida` that implements `Profunctor` and hence uses this generalized contravariance - check out [valida](https://hackage.haskell.org/package/valida)!
 
 # Comparison and Motivation
 The concept of the `Validation` data type used in this package isn't new. It's also used in the following packages-
src/Valida.hs view
@@ -2,7 +2,7 @@ 
 {- |
 Module      : Valida
-Description : Simple applicative validation for product types, batteries included!
+Description : Primary Valida module, exporting everything needed to build validators.
 Copyright   : (c) TotallyNotChase, 2021
 License     : MIT
 Maintainer  : totallynotchase42@gmail.com
@@ -126,7 +126,7 @@ labelV err (Validator v) = Validator $ first (const err) . v
 
 -- | A synonym for 'labelV' with its arguments flipped.
-infix 6 <??>
+infix 0 <??>
 
 (<??>) :: Validator x inp a -> e -> Validator e inp a
 (<??>) = flip labelV
valida-base.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           valida-base-version:        0.1.1+version:        0.2.0 synopsis:       Simple applicative validation for product types, batteries included! description:    This is a zero dependency version of the valida package. It is equivalent to valida == 0.1.0. Check out the README at github <https://github.com/TotallyNotChase/valida-base#readme>! category:       Validation, Data@@ -40,7 +40,7 @@       src   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-uni-patterns -Wmissed-specialisations -Wmissing-export-lists -Wpartial-fields -Wredundant-constraints -O2   build-depends:-      base >=4.13 && <5+      base >=4.12 && <5   default-language: Haskell2010  test-suite valida-test@@ -54,8 +54,8 @@       test   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-uni-patterns -Wmissed-specialisations -Wmissing-export-lists -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N   build-depends:-      base >=4.13 && <5-    , smallcheck+      base >=4.12 && <5+    , smallcheck >=1.2.0     , tasty     , tasty-hunit     , tasty-quickcheck