Giter Club home page Giter Club logo

charset's Introduction

charsets

Hackage Build Status

Fast utf-8 character sets for Haskell represented as complemented PATRICIA tries.

Contact Information

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

charset's People

Contributors

ekmett avatar emwap avatar felixonmars avatar harendra-kumar avatar markwright avatar phadej avatar ryanglscott avatar sboosali avatar skvadrik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

charset's Issues

`isSubsetOf` is broken if the left set is complemented and the right one isn't

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.

Doesn't build with GHC 9.2

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#))
   |                                              ^^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.