New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate dependence on data-binary-ieee754 #414
Comments
Looks like this is all the code we need from that library: module CastFloatsToWords(floatToWord, wordToFloat, doubleToWord, wordToDouble) where
import Data.Word
import qualified Foreign as F
import System.IO.Unsafe (unsafePerformIO)
floatToWord :: Float -> Word32
floatToWord = fromFloat
wordToFloat :: Word32 -> Float
wordToFloat = toFloat
doubleToWord :: Double -> Word64
doubleToWord = fromFloat
wordToDouble :: Word64 -> Double
wordToDouble = toFloat
toFloat :: (F.Storable word, F.Storable float) => word -> float
toFloat word = unsafePerformIO $ F.alloca $ \buf -> do
F.poke (F.castPtr buf) word
F.peek buf
fromFloat :: (F.Storable word, F.Storable float) => float -> word
fromFloat float = unsafePerformIO $ F.alloca $ \buf -> do
F.poke (F.castPtr buf) float
F.peek buf I'm not sure if cereal exposes these functions. We can easily "steal" this and put it into a utility function and get rid of the dependency if that package disappears. I see no immediate reason to do so however. Do you have any other concerns regarding that library? |
I would like to create a FreeBSD port for |
Note that SBV depends on CrackNum (http://hackage.haskell.org/package/crackNum) which also has a dependence on I'm not familiar with the process of porting to FreeBSD; is there a reason why "cabal install sbv" doesn't just work? |
Yes, there is a reason. 'cabal install sbv' can't be run because it downloads files, and all downloaded files need to be fingerprinted for security reasons, so such commands can't be used in ports. It's the same for Debian, etc. |
Looks like this package is a drop-in-replacement that we can use: http://hackage.haskell.org/package/reinterpret-cast |
It says on its author's website https://john-millikin.com/software that
data-binary-ieee754
is obsolete andcereal
should be preferred.The text was updated successfully, but these errors were encountered: