Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Replace Maybe with Either ...smth... in BiMap #137

Closed
chshersh opened this issue Nov 10, 2018 · 2 comments
Closed

Replace Maybe with Either ...smth... in BiMap #137

chshersh opened this issue Nov 10, 2018 · 2 comments
Assignees

Comments

@chshersh
Copy link
Contributor

This is needed to give better error messages.

@willbasky
Copy link
Collaborator

Subject is about

data BiMap a b = BiMap
    { forward  :: a -> Maybe b
    , backward :: b -> Maybe a
    }

and all derivations?

@chshersh
Copy link
Contributor Author

chshersh commented Nov 17, 2018

@willbasky Yes, that's right. I assume that after refactoring this should look something like:

data BiMap e a b = BiMap
    { forward  :: a -> Either e b
    , backward :: b -> Either e a
    }

And then all current BiMaps will have the following type:

type BiToml = BiMap SomeTomlError

@willbasky willbasky self-assigned this Nov 17, 2018
chshersh pushed a commit that referenced this issue Jan 4, 2019
* [#137] Replace Maybe with Either in BiMap

* Return Maybe and refactor

* Improve Error type

* Update src/Toml/BiMap.hs

Co-Authored-By: willbasky <vladislav.sabanov@gmail.com>

* Update src/Toml/BiMap.hs

Co-Authored-By: willbasky <vladislav.sabanov@gmail.com>

* Fix Error type and add more Either

* Refactor 1

* Fix _NonEmpty

* Refactor it

* Fix matchError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants