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

Spooky code #2

Open
bitemyapp opened this issue Jun 3, 2015 · 4 comments
Open

Spooky code #2

bitemyapp opened this issue Jun 3, 2015 · 4 comments

Comments

@solatis
Copy link
Owner

solatis commented Jun 3, 2015

Thanks for the review! I'll take a look at them ASAP -- the type aliases shouldn't be too much of a problem, so that tackles 90% of your comments.

With regards to "what if it fails to parse", either a ProtocolError is thrown (if the message could be parsed but is not what we expected) or fail is called by network-attoparsec: https://github.com/solatis/haskell-network-attoparsec/blob/master/src/Network/Attoparsec.hs#L114

@bitemyapp
Copy link
Author

@solatis

With regards to "what if it fails to parse",

I don't have strong opinions here. My preference is to not "hide" input-related errors into an exception/fail/error, and reserve exceptions for exceptional cases but you might very well have a good reason for doing as you do so I'm not going to make a recommendation. Errors that can be caused by mere input invalidity I usually lift into a sum type and return in EitherT. Usually.

Sounds like you're on the right track then. Good hacking :) 🐻

@solatis
Copy link
Owner

solatis commented Jun 3, 2015

Well I explicitly decided to also use MonadMask / MonadCatch for that reason, to not 'hide' the exceptions. but I get where you're coming from: exceptions have an impure feeling to them, and it might be cleaner to use Either.

Doing that would require a lot of refactoring, though, so at the moment I'm going to pass on that one. I decided to model the library in the same way as Haskell's IO is modeled, which also works with exceptions.

I'll make a separate issue out of that one, though, so I won't forget.

@bitemyapp
Copy link
Author

@solatis yeah I don't feel strongly about MonadMask/MonadCatch vs. EitherT in this case at all. I don't think the churn is worth it until you've kicked it around and have a feel for things.

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

No branches or pull requests

2 participants