-
Notifications
You must be signed in to change notification settings - Fork 1
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
Improve fromBytes type signature #2
Comments
The only thing keeping me from changing the signature of I submitted elm/bytes#17 which would hopefully clear this up, but until then I'd rather keep this I do have a commit that changes the function's signature and adds a test with a fuzzy sequence of bytes to make sure it always return |
First of all, thank you for creating this package! :) I found it because I've been looking for a base64 package that has a proper signature for base64 encoding that does not introduce an error type to the result and uses a proper input type. This package has almost everything I was looking for, except the return type. I see the reasoning behind keeping the However, when used in another package this leads to that package using the same reasoning to keep the My concrete use-case is with a package I wrote that can create Thumbor URLs. I use https://github.com/romariolopezc/elm-hmac-sha1 to sign those URLs as required by Thumbor. This results in https://github.com/itravel-de/elm-thumbor/blob/1.0.0/src/Thumbor.elm#L162 where I have to resolve this with a special fallback string. I wanted to open a PR for I think resolving this "impossible state" should happen as early as possible so that it does not "infect" more code. Have you had the chance to look more deeply into this since the last comment? I am happy to help out if I can! :) |
I still haven't gotten a response on elm/bytes#17. The minute (or week) I do, I'll update this package, but until then I don't feel comfortable changing this. |
This function should never return Nothing, but it uses Bytes.Decode.decode, which returns a Maybe String.
If this is the case, can't you modify
fromBytes
to look like this?The default value will never get used (if it does there's a bug which should be fixed anyway) and the user gets a nicer API to work with.
The text was updated successfully, but these errors were encountered: