Add a Testable instance for Either

Open
#92 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Domain
testing

Research direction

Start by reading the existing Testable instances in purescript-quickcheck and the Either type and note usage shown in the issue. Determine which instance or instances are needed to make Either String Unit usable with the testing machinery, then check the project’s tests for the expected behavior. Done means the instance supports the shown composition pattern and has tests covering it.

Written by the indexing model from the issue text.

Description

type: enhancement

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.

Dominant language
PureScript
Stars
108
Forks
42
Avg merge
2d 23h
Merged PRs (30d)
1

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from purescript/purescript-quickcheck

All issues in purescript/purescript-quickcheck

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.