[Haskell-cafe] instance Alternative (Either [a])

John Meacham john at repetae.net
Thu May 22 04:28:15 UTC 2014


I use a similar idiom

newtype P b a = P ([b],Maybe a)

Note that the [b] is _outside_ the maybe (or either), this means that
the accumulated value can be propagated through failure.

Notably, <*> and `ap` have very different meanings for this which is
not true for other monads. <*> will collect [b] from both sides while
`ap` will only do the left.

    John


   John

On Wed, May 21, 2014 at 9:18 PM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:
>
> On Thu, May 22, 2014 at 6:58 AM, Tony Morris <tmorris at tmorris.net> wrote:
>>
>>
>> http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html
>
>
> I don't understand how to use this package.
>
> Is it because Either is an ugly name for the data type and Validation is
> preferable?
>
> And AccValidation is to be used over Validation, like in Hungarian notation,
> to indicate (the possibility of?) a Semigroup instance on Left / Failure?
>
>
> -- Kim-Ee



-- 
John Meacham - http://notanumber.net/


More information about the Haskell-Cafe mailing list