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

Use type-level Set for exceptions #4

Open
chshersh opened this issue Mar 20, 2021 · 2 comments
Open

Use type-level Set for exceptions #4

chshersh opened this issue Mar 20, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@chshersh
Copy link
Contributor

chshersh commented Mar 20, 2021

Currently we just append lists. This can probably not be optimal for longer lists of exceptions.
We need to do something more efficient. Probably even use some GHC source plugin for type-level sets.

Using type-level sets has the following advantages:

  • Order of exceptions doesn't matter
  • All duplicates are removed
  • If implemented via some good source-plugin, probably will be even more efficient than defining our own type families
@chshersh chshersh added the enhancement New feature or request label Mar 20, 2021
@chshersh chshersh changed the title Use more efficient exceptions concatenation Use type-level Set for exceptions Mar 22, 2021
@JonathanLorimer
Copy link

Does it make sense to use this package https://github.com/isovector/type-sets/ ?

@chshersh
Copy link
Contributor Author

chshersh commented Apr 2, 2021

It's probably possible. But I'm afraid that the ergonomics will suffer. As far as I can tell from the library, the type-level set of exceptions needs to be constructed like this:

type Exceptions1 = Insert MyErr1 (Insert MyErr2 'Empty))

foo :: EIO Exceptions1 ()

While I was thinking more in the following design space:

foo :: EIO '[ MyErr1, MyErr2 ] ()

where the source plugin automatically creates sets for lists in the EIO type. So it will look more readable 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants