-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[#7] Custom Errors for runEIO #13
base: main
Are you sure you want to change the base?
[#7] Custom Errors for runEIO #13
Conversation
ghcid.txt | ||
|
||
# Stack | ||
.stack-work/ | ||
stack.yaml.lock | ||
|
||
# Nix | ||
shell.nix | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you don't mind me adding these. I like to use nix-shell
to pull in all the project dependencies (such as ghc, and cabal) and use ghcid
for development. I didn't want to clutter up anyone else's workflow so I added the files I use to .gitignore. If this is annoying I can just stage my files more carefully and remove this.
( 'Text "The 'runEIO' handler requires that all exceptions in 'EIO' to be handled." | ||
':$$: 'Text "The action 'runEIO' is applied to throws the following unhandled exceptions:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to keep the text as similar to your suggestion as possible.
src/EIO.hs
Outdated
@@ -62,9 +63,10 @@ safeMain = EIO.do | |||
|
|||
@since 0.0.0.0 | |||
-} | |||
runEIO :: EIO '[] () -> IO () | |||
runEIO :: DisallowUnhandledExceptions excepts => EIO excepts () -> IO () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being new to custom type errors, and type level programming in general, I wasn't sure if there was a cleaner way to convey, to the consumer of this function, that the type variable excepts
is constrained to the kind [Type]
Whoops, this isn't actually ready for review, I added DocTests and found a bug where my type family for a custom error message can't resolve |
Okay, sorted out the funny type error, I was using the EIO constructor to lift an IO action, but I really need an |
This haskell code generates the corresponding type error: