Open alexeygolev opened 7 years ago
It does seem to be similar to scalaz validation
Yep. Adapted from http://eed3si9n.com/learning-scalaz/Validation.html
// @flow
import { getApplicative } from 'flow-static-land/lib/Validation'
import * as either from 'flow-static-land/lib/Either'
import { stringMonoid } from 'flow-static-land/lib/Monoid'
const applicative = getApplicative(stringMonoid)
const x = either.right('event 1 ok')
const y = either.left('event 2 failed!')
const z = either.left('event 3 failed!')
const validation = applicative.ap(applicative.ap(applicative.map(a => b => c => a + b + c, x), y), z)
console.log(validation) // => Left {value0: "event 2 failed!event 3 failed!"}
Thank you for the library! It's very impressive. I'm trying to wrap my head around validation but struggling to do so. It does seem to be similar to scalaz validation but I'm not sure how would I use it. Any chance for an example? Thank you again