idontgetoutmuch / binary-low-level Goto Github PK
View Code? Open in Web Editor NEWA strict version of the Get monad from the binary package.
License: Other
A strict version of the Get monad from the binary package.
License: Other
I guess 4c340d1 introduced this. These files are missing, that are necessary for the package to build on Nixpkgs:
./src/Data/Binary/Strict/Common.h
./tests/BitGetTest.hs
Would it be possible to get a new release on hackage with these files included?
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?
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
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
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.
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.
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 either
Foreign.unsafePerformIO',
imported from Foreign' at src/Data/Binary/BitBuilder.hs:38:1-14 or
System.IO.Unsafe.unsafePerformIO',
imported from System.IO.Unsafe' at src/Data/Binary/BitBuilder.hs:42:26-40 (and originally defined in
GHC.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
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.
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+.
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.