Coder Social home page Coder Social logo

binary-low-level's Introduction

Hi there 👋

binary-low-level's People

Contributors

dmcclean avatar erictapen avatar idontgetoutmuch avatar sorki avatar swamp-agr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

binary-low-level's Issues

Running the BitGet monad over a bit string whose length isn't divisible by 8

Is there anything in BitGet that corresponds to the putLeftByteString function in BitPut?

In other words, if I have a bit string represented as a ByteString of 44 bytes, and I know that only 2 bits of the last byte are actually part of the bit string, is there any way to runBitGet over that bit string?

Missing Imports?

I want to use binary-strict in my project to parse captured frames in binary. However, building binary-strict failed with the following message:

Building binary-strict-0.4.8.3...
Preprocessing library binary-strict-0.4.8.3...

src/Data/Binary/Strict/BitGet.hs:2:16: Warning:
    -fglasgow-exts is deprecated: Use individual extensions instead

src/Data/Binary/Strict/Get.hs:2:16: Warning:
    -fglasgow-exts is deprecated: Use individual extensions instead

src/Data/Binary/Strict/IncrementalGet.hs:2:16: Warning:
    -fglasgow-exts is deprecated: Use individual extensions instead
[1 of 9] Compiling Data.Binary.Strict.Util ( src/Data/Binary/Strict/Util.hs, dist/build/Data/Binary/Strict/Util.o )
[2 of 9] Compiling Data.Binary.Strict.Class ( src/Data/Binary/Strict/Class.hs, dist/build/Data/Binary/Strict/Class.o )
[3 of 9] Compiling Data.Binary.Strict.IncrementalGet ( src/Data/Binary/Strict/IncrementalGet.hs, dist/build/Data/Binary/Strict/IncrementalGet.o )

src/Data/Binary/Strict/IncrementalGet.hs:104:10: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `S'
    In the definition of data constructor `S'
    In the data declaration for `S'

src/Data/Binary/Strict/IncrementalGet.hs:104:10: Warning:
    Ignoring unusable UNPACK pragma on the third argument of `S'
    In the definition of data constructor `S'
    In the data declaration for `S'
[4 of 9] Compiling Data.Binary.Strict.Get ( src/Data/Binary/Strict/Get.hs, dist/build/Data/Binary/Strict/Get.o )
[5 of 9] Compiling Data.Binary.Strict.BitUtil ( src/Data/Binary/Strict/BitUtil.hs, dist/build/Data/Binary/Strict/BitUtil.o )
[6 of 9] Compiling Data.Binary.Strict.BitGet ( src/Data/Binary/Strict/BitGet.hs, dist/build/Data/Binary/Strict/BitGet.o )

src/Data/Binary/Strict/BitGet.hs:84:10:
    Not in scope: type constructor or class `Applicative'

After some inspection, it seems the problem is that

  1. src/Data/Binary/Strict/BitGet.hs does not import Control.Applicative and Control.Moand, and
  2. src/Data/Binary/BitPut.hs also does not import Control.Applicative.

I am able to build and install the binary-strict package after adding these imports. I am using GHC version 7.6.3, which is installed from haskell-platform package in Linux Mint 17.1.

Is is problem due to misconfiguration in my side, or would you consider including the fix? As a novice, I too apologize if the question is obvious, or off-base, or should be reported in a different manner.

Best,
Tao

Release 0.4.8.4 on Hackage

Hackage shows currently an old version of this package. Would it be possible to publish the newest release there?

That'd possibly fix a build failure in Nixpkgs.

Fails to install in cabal sandbox due to build failure with GHC 7.10.1

With this file:

name:                test
version:             0.1.0.0
license:             BSD3
license-file:        LICENSE
author:              Foo Bar
maintainer:          [email protected]
build-type:          Simple
cabal-version:       >=1.10

executable test
  main-is:             Main.hs
  build-depends:       base
                     , binary-strict
  hs-source-dirs:      src
  default-language:    Haskell2010

cabal install --only-dependencies fails with:

Resolving dependencies...
Notice: installing into a sandbox located at
/home/foobar/coding/haskell/experiments/cabal_binary_strict/.cabal-sandbox
Configuring binary-strict-0.4.7...
Building binary-strict-0.4.7...
Failed to install binary-strict-0.4.7
Build log ( /home/foobar/coding/haskell/experiments/cabal_binary_strict/.cabal-sandbox/logs/binary-strict-0.4.7.log ):
Configuring binary-strict-0.4.7...
Building binary-strict-0.4.7...
Preprocessing library binary-strict-0.4.7...

src/Data/Binary/Strict/BitGet.hs:2:16: Warning:
-fglasgow-exts is deprecated: Use individual extensions instead

src/Data/Binary/Strict/Get.hs:2:16: Warning:
-fglasgow-exts is deprecated: Use individual extensions instead

src/Data/Binary/Strict/IncrementalGet.hs:2:16: Warning:
-fglasgow-exts is deprecated: Use individual extensions instead

src/Data/Binary/BitPut.hs:39:8:
Could not find module ‘Control.Monad.Trans’
It is a member of the hidden package ‘mtl-2.2.1@mtl_6HevPxzlSPX058IyhMPnF5’.
Perhaps you need to add ‘mtl’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.

src/Data/Binary/BitPut.hs:40:8:
Could not find module ‘Control.Monad.Error’
It is a member of the hidden package ‘mtl-2.2.1@mtl_6HevPxzlSPX058IyhMPnF5’.
Perhaps you need to add ‘mtl’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
binary-strict-0.4.7 failed during the building phase. The exception was:
ExitFailure 1

Adding mtl to the dependencies makes no difference.

Fails to build under 7.6.3

I recently attempted to install a package which depends on the
binary-strict module, for which you are listed as the maintainer, and
encountered an error. I am writing to report the issue and ask for
your advice.

The error that I am seeing is the same one encountered by jaybee on
StackOverflow at http://stackoverflow.com/q/27574930 and reproduced
below:

src/Data/Binary/BitBuilder.hs:205:37:
Ambiguous occurrence unsafePerformIO' It could refer to eitherForeign.unsafePerformIO',
imported from Foreign' at src/Data/Binary/BitBuilder.hs:38:1-14 orSystem.IO.Unsafe.unsafePerformIO',
imported from System.IO.Unsafe' at src/Data/Binary/BitBuilder.hs:42:26-40 (and originally defined inGHC.IO')
Failed to install binary-strict-0.4.8.1

Tomas M. DuBuisson suggested this was an incompatibility with base
4.6.* and could be addressed by adding hiding (unsafePerformIO) to
import Foreign.

Although upgrading to a more recent GHC would solve the issue, the
package which I am attempting to install (webify) requires
base == 4.6.*.

Is it possible to install binary-strict with base 4.6.*? Or would you
consider including the fix suggested above? I'm a Haskell novice, so
I apologize if the question is obvious, or off-base, or should be
reported in a different manner.

Any suggestions/feedback is appreciated.

Thanks,
Kevin

Reading signed integers with BitGet

Would you be interested in a patch to allow reading of signed Int16, Int32, etc types in the BitGet monad with functions like getAsInt16 alongside the unsigned getAsWord16 (etc) functions that are already there?

The Data.Word documentation says:

Coercing word types to and from integer types preserves representation, not sign.

so these would need to perform sign extension prior to the cast.

I am writing a parser for a binary format that makes extensive use of small signed fields, for example signed 28 bit longitudes and 27 bit latitudes.

Make compatible with GHC 9.2

When attempting to compile with GHC 9.2.2, the first encountered error is a version bound set by the cabal file:

base >=4.12 && <4.16, bytestring >=0.10 && <0.11

When ignoring those version bounds (e.g. by using Nix' pkgs.haskell.lib.doJailbreak function, the following errors pop up on compile:

src/Data/Binary/Strict/BitGet.hs:179:14: error:
    Not in scope: ‘BI.inlinePerformIO’
    Module ‘Data.ByteString.Internal’ does not export ‘inlinePerformIO’.
    |
179 |     return . BI.inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
    |              ^^^^^^^^^^^^^^^^^^
[3 of 9] Compiling Data.Binary.BitBuilder ( src/Data/Binary/BitBuilder.hs, dist/build/Data/Binary/BitBuilder.o, dist/build/Data/Binary/BitBuilder.dyn_o )
src/Data/Binary/BitBuilder.hs:48:34: error:
    Module ‘Data.ByteString.Internal’ does not export ‘inlinePerformIO’
   |
48 | import Data.ByteString.Internal (inlinePerformIO)
   |                                  ^^^^^^^^^^^^^^^
[5 of 9] Compiling Data.Binary.Strict.ByteSet ( src/Data/Binary/Strict/ByteSet.hs, dist/build/Data/Binary/Strict/ByteSet.o, dist/build/Data/Binary/Strict/ByteSet.dyn_o )
[6 of 9] Compiling Data.Binary.Strict.Class ( src/Data/Binary/Strict/Class.hs, dist/build/Data/Binary/Strict/Class.o, dist/build/Data/Binary/Strict/Class.dyn_o )
[7 of 9] Compiling Data.Binary.Strict.Get ( src/Data/Binary/Strict/Get.hs, dist/build/Data/Binary/Strict/Get.o, dist/build/Data/Binary/Strict/Get.dyn_o )
src/Data/Binary/Strict/Get.hs:283:14: error:
    Not in scope: ‘B.inlinePerformIO’
    Neither ‘Data.ByteString’ nor ‘Data.ByteString.Internal’ exports ‘inlinePerformIO’.
    |
283 |     return . B.inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
    |              ^^^^^^^^^^^^^^^^^
[8 of 9] Compiling Data.Binary.Strict.IncrementalGet ( src/Data/Binary/Strict/IncrementalGet.hs, dist/build/Data/Binary/Strict/IncrementalGet.o, dist/build/Data/Binary/Strict/IncrementalGet.dyn_o )
src/Data/Binary/Strict/IncrementalGet.hs:310:14: error:
    Not in scope: ‘B.inlinePerformIO’
    Neither ‘Data.ByteString’ nor ‘Data.ByteString.Internal’ exports ‘inlinePerformIO’.
    |
310 |     return . B.inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
    |              ^^^^^^^^^^^^^^^^^

Some work is required to make this package compatible with GHC 9.2.x+.

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.