Skip to content

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

Draft
igrep wants to merge 1 commit into
dmjio:masterfrom
igrep:single-error
Draft

(WIP, RFC) Distinguish variable-not-found-error from others#35
igrep wants to merge 1 commit into
dmjio:masterfrom
igrep:single-error

Conversation

@igrep
Copy link
Copy Markdown
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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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