Fast utf-8 character sets for Haskell represented as complemented PATRICIA tries.
Contributions and bug reports are welcome!
Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.
-Edward Kmett
fast utf-8 character sets
License: BSD 3-Clause "New" or "Revised" License
Add flag description:
flag OldTypeable
Consider:
>>> import Data.CharSet
>>> let c1 = complement $ singleton 'a'
>>> let c2 = build ((/=) 'a')
>>> isSubsetOf c1 c2
False
Clearly, isSubsetOf
should return True
here. The problem is the following line in the implementation:
isSubsetOf (CharSet False _ i) (CharSet True _ j) = all (\x -> I.member x i && I.member x j) [ol..oh] -- not bloody likely
The fix is easy: instead of &&
it should be ||
. But actually, we can do better:
isSubsetOf (CharSet False _ i) (CharSet True _ j) = numChars == I.size (I.union i j)
I'll link a PR to this issue with the fix.
After word representation changes in ghc-prim
[1 of 9] Compiling Data.CharSet.ByteSet ( src/Data/CharSet/ByteSet.hs, dist/build/Data/CharSet/ByteSet.o, dist/build/Data/CharSet/ByteSet.dyn_o )
src/Data/CharSet/ByteSet.hs:53:32: error:
• Couldn't match expected type ‘ghc-prim-0.8.0:GHC.Prim.Word8#’
with actual type ‘ghc-prim-0.8.0:GHC.Prim.Word#’
• In the first argument of ‘W8#’, namely
‘(narrow8Word# (x# `shiftL#` i#))’
In the expression: W8# (narrow8Word# (x# `shiftL#` i#))
In an equation for ‘shiftL’:
shiftL (W8# x#) (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))
|
53 | shiftL (W8# x#) (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/CharSet/ByteSet.hs:53:46: error:
• Couldn't match expected type ‘ghc-prim-0.8.0:GHC.Prim.Word#’
with actual type ‘ghc-prim-0.8.0:GHC.Prim.Word8#’
• In the first argument of ‘shiftL#’, namely ‘x#’
In the first argument of ‘narrow8Word#’, namely ‘(x# `shiftL#` i#)’
In the first argument of ‘W8#’, namely
‘(narrow8Word# (x# `shiftL#` i#))’
|
53 | shiftL (W8# x#) (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))
| ^^
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.