purescript-quickcheck
purescript-quickcheck copied to clipboard
Add a Testable instance for Either
Result
is not a very composable data type, which makes it clunky to work with. If we add a Testable
instance for Either String Unit
we can use the whole machinery around the Either
type and make testing a much more pleasant experience.
Contrived example of pleasant experience:
p :: Array String -> Either String Unit
p a = do
i <- note "Couldn't find hello." (elemIndex "hello" a)
if mod i 2 > 0
then Left "hello isn't on an index divisible by two."
else Right unit
In my opinion this experience becomes pleasant because I can use do-notation, note
and a load of other niceties.
If you think this is a good idea I can implement the instance(s) needed and make a PR.
Seems reasonable to me!
Then I'll start hacking and get back with a PR in a few weeks.