purescript-validation icon indicating copy to clipboard operation
purescript-validation copied to clipboard

Add qualified do module for (semigroup) `V`

Open JordanMartinez opened this issue 3 years ago • 0 comments

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.

JordanMartinez avatar Jun 14 '22 23:06 JordanMartinez