-
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
Merge ByteString and Text functions and types #39
Comments
Also, I don't see much value in definitions like this:
I would just replace uses of |
@ddssff do you think we should move away from implementing via the ST monad right (replace with Writer monad)? If so a lot of these functions probably wont be necessary anymore. I still wonder about performance though, doesn't the ST monad allow for scoped mutation (should allow for a Haskellish way to maintain near C performance)? Maybe the current ST monad implementation isn't any faster than say implementing via the Writer monad (I like the Writer monad way much better). |
Honestly, I don't understand how the ST monad affects performance. I did the writer monad implementation by incrementally transforming the ST monad implementation, so first I had to do the work described in this ticket - parameterize the ByteString / Text type, inline trival functions and types, etc. Once that is done we can convert to Writer monad but keep the ST monad version. Then perhaps some benchmarking. |
My guess is that high performance is something you will have to do afterwards. But regular pure haskell does a pretty good job on its own. |
One more suggestion - use pattern matching and the |
Sorry for the delay, will be looking into this soon. |
No problem, I've been very busy. |
In order to eliminate duplicate code, all the ByteString and Text specific functions are merged into functions that have a type parameter
b
with the constraintsforall b. (Pack b) =>
. Theforall
, along with{-# LANGUAGE ScopedTypeVariables #-}
, lets you useb
in signatures throughout the function to refer to the exact type used in the main signature. Remove the B and T suffixes from all functions and types. You may also need{-# LANGUAGE TypeFamilies #-}
.The text was updated successfully, but these errors were encountered: