Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(WIP, RFC) Distinguish variable-not-found-error from others #35

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

igrep
Copy link
Contributor

@igrep igrep commented Jan 24, 2020

Problem

  • Handling Maybe values in the Parser monad is troublesome.
  • Even envMaybe mixes up variable-not-found-error with others,
    which makes the difference of Nothing and Left String
    obscure.

Solution

Change the error type of Parser a from just a String into
a dedicated error ADT ParseError.

NOTE

@igrep igrep changed the title (WIP) Distinguish variable-not-found-error from others (WIP, RFC) Distinguish variable-not-found-error from others Jan 24, 2020
Problem
====

- Handling `Maybe` values in the `Parser` monad is troublesome.
- Even `envMaybe` mixes up variable-not-found-error with others,
  which makes the difference of `Nothing` and `Left String`
  obscure.

Solution
====

Change the error type of `Parser a` from just a `String` into
a dedicated error ADT `ParseError`.

NOTE
====

- Fix dmjio#30 as a bonus!
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fromVar should return an Either String a
1 participant