Code Monkey home page Code Monkey logo

purescript-validation's Introduction

purescript-validation's People

Contributors

anttih avatar colin-lamed avatar cryogenian avatar garyb avatar hdgarrood avatar jkachmar avatar jordanmartinez avatar kl0tl avatar liamgoodacre avatar milesfrain avatar paf31 avatar safareli avatar telser avatar thomashoneyman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

purescript-validation's Issues

More Complete Examples for Semigroup and Semiring Validation

I worked out some more complete examples of validations using the Semigroup and Semiring instances today. They're pretty opinionated, but I think having a more completely worked out example in the repository could help newcomers.

Right now they're in a separate repo here, but if this seems like something the maintainers would like, I can clean them up and put them into a proper PR.

Validation eliminator

Is there a reason for having unV instead of a validation eliminator, like maybe or either? If not, should we deprecate unV in favor of such eliminator?

Export the V data constructor

If I try and create a Validator with the new type it doesn't recognize V as a data constructor.

--my module
import Data.Validation.Semigroup (V(..), V, invalid)

--Try to use it
valid :: forall err result. result -> V err result
valid = V <<< Right

Error: Unknown data constructor V

I'm new to PS, but this article seems to say that V needs to be exported from the Validation lib like V(..) to be able to use it.
https://stackoverflow.com/questions/47677049/importing-newtypes-from-another-module

Am I missing something?

Versions

@garyb Any idea why the release versions are still 0.0.* in this repo? Can I make the next release 0.1.0?

Suggestion: remove Semiring Validation from core

For some code to be part of the core libraries, I think there should be quite a high bar to meet. The core team should be able to understand and maintain it, it should be robust and correct, and it should be something we expect people to want to use regularly in their programs. I'm not sure Data.Validation.Semiring meets that bar. I certainly don't understand it - I don't understand why you would want to be able to combine errors in two different ways like that. It has also proven resistant to efforts to document it. Additionally, the type which you're meant to use for accumulating errors, Data.Semiring.Free, isn't even a real Semiring: purescript/purescript-semirings#11.

Given all of these things, I think Data.Validation.Semiring (and probably Data.Semiring.Free too) would be best moved to a separate non-core library.

Add qualified do module for (semigroup) `V`

The Data.Validation.Semigroup V does not have a Bind instance because it can lead to unexpected results despite it otherwise working fine. That makes sense, but when I do want that behavior, I can use andThen. Unfortunately, it means I can't use do notation anymore.

As a workaround, perhaps a module should be added to this repo which exposes the following module?

module Data.Validation.Semigroup.QualifiedDo

import Data.Validation.Semigroup (V, andThen)

bind :: -- type signature
bind = andThen

Then, when imported as import Data.Validation.Semigroup.QualifiedDo as V, we can use V.do. Since its qualified do notation, one is able to see that something 'special' is going on with the bind calls.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.