Twitter: @fumieval
fumieval / mason Goto Github PK
View Code? Open in Web Editor NEWfleet-footed ByteString builder
License: BSD 3-Clause "New" or "Revised" License
fleet-footed ByteString builder
License: BSD 3-Clause "New" or "Revised" License
Twitter: @fumieval
> doubleDec 6.248372003193505e15 & toStrictByteString
"6248372003193505"
Yet they are used in public signatures. E.g.,
toStrictByteString :: BuilderFor GrowingBuffer -> ByteString
This means that to provide a signature for a function using this one the user will have to reach out for an internal module.
So could you either reexport the backend types in the public module or if you don't want to, could you at least expose aliases like the following?
type GrowingBufferBuilder = BuilderFor GrowingBuffer
Seeing that all this confusion is caused by the use of Internal module, I want to express other arguments and try to convince you to not expose internal modules.
As far as I know, GHC (up to 8.6.1 at least) does not unpack tuples under IO
. Hence, s -> Buffer -> IO Buffer
in BuilderFor
always returns with an extra heap indirection. This can be fixed by using RealWorld#
and unboxing manually. I'm not sure if this makes a significant difference here, I'm just noting it as a potential optimization.
Hi! Thanks for implementing and maintaining this awesome library! I'm currently looking for the ByteString builder library, and I wonder, what is the fastest option available in Haskell.
There's the benchmark of all bytestring builders in the haskell-perf
organization:
But I see that it lacks the benchmark with mason
. I think it would be lovely and beneficial for the community, if you could provide implementation of the existing bench suite for mason
, so all existing libraries will be covered🙂 Also, according to the strict-bytestring-builders
benchmark, the bytestring-strict-builder
library is the fastest at the moment, but I'm curious, how it compares to mason
🤔
Hi,
I tried to replace ByteString.Builder with Mason.
According to the docs it looks pretty easy - just replace imports and add new cabal dependency,
but GHC fails with on every function mentionting Builder with following error?
• Illegal polymorphic type: forall s. Buildable s => BuilderFor s
GHC doesn't yet support impredicative polymorphism
• In the expansion of type synonym ‘Builder’
In the type signature: mm :: IO (IORef (Int, Builder))
|
52 | mm :: IO (IORef (Int, MB.Builder))
If Builder type cannot be use in functions this fact should mentioned, cause
it limits library capability.
If not an example with tricky configuration would be helpful.
Version 2.0 for the text
package switched to UTF-8 for internal representation, which included changing functions in Data.Text.Array
from using Word16
to Word8
. Some CPP flagging should be able to fix this.
This should fix GHC 9.4 support, which seems to be failing because text-1.2.5.0 has some ghc-prim conflict with bytestring.
Building library for mason-0.2.5..
[1 of 4] Compiling Mason.Builder.Internal
/var/stackage/work/unpack-dir/unpacked/mason-0.2.5-4eda0ef67a4f4475f8ab1dc38aca2a86ff5a522eab57e7c63ddc66b4da9bd874/src/Mason/Builde
r/Internal.hs:497:48: error:
• Couldn't match expected type ‘GHC.Word.Word16’
with actual type ‘Word8’
• In the first argument of ‘U16.chr2’, namely ‘w’
In the second argument of ‘($)’, namely
‘U16.chr2 w (A.unsafeIndex arr (i + 1))’
In the expression: ord $ U16.chr2 w (A.unsafeIndex arr (i + 1))
|
497 | let c = ord $ U16.chr2 w (A.unsafeIndex arr (i+1))
| ^
/var/stackage/work/unpack-dir/unpacked/mason-0.2.5-4eda0ef67a4f4475f8ab1dc38aca2a86ff5a522eab57e7c63ddc66b4da9bd874/src/Mason/Builde
r/Internal.hs:497:51: error:
• Couldn't match expected type ‘GHC.Word.Word16’
with actual type ‘Word8’
• In the second argument of ‘U16.chr2’, namely
‘(A.unsafeIndex arr (i + 1))’
In the second argument of ‘($)’, namely
‘U16.chr2 w (A.unsafeIndex arr (i + 1))’
In the expression: ord $ U16.chr2 w (A.unsafeIndex arr (i + 1))
|
497 | let c = ord $ U16.chr2 w (A.unsafeIndex arr (i+1))
| ^^^^^^^^^^^^^^^^^^^^^^^
Can you please prepare a new release to include #9?
Currently, we have intersperse :: Buildable e => BuilderFor e -> [BuilderFor e] -> BuilderFor e
. However, this is too restrictive, as it should be able to be applied to any linear collection. Is there anything stopping us from having something like:
intersperse :: (Buildable e, Foldable t) => BuilderFor e -> t (BuilderFor e) -> BuilderFor e
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.