Hello Andrew,
Thursday, May 31, 2007, 11:47:28 PM, you wrote:
(Otherwise... wasn't there some library somewhere for serialising values
in binary?)
Binary, AltBinary (see latest HCAR), just an example using AltBinary:
main = do
let s = encode (1.1::Float) -- s has type String
Donald Bruce Stewart wrote:
let s = encode (1.1 :: Float)
:t s
s :: Data.ByteString.Lazy.ByteString
s
LPS [\NUL\NUL\140\204\205\255\255\255\255\255\255\255\233]
decode s :: Float
1.1
But doesn't Data.Binary serialise to a guaranteed representation, i.e.
bulat.ziganshin:
Hello Andrew,
Thursday, May 31, 2007, 11:47:28 PM, you wrote:
(Otherwise... wasn't there some library somewhere for serialising values
in binary?)
Binary, AltBinary (see latest HCAR), just an example using AltBinary:
main = do
let s = encode (1.1::Float)
jules:
Donald Bruce Stewart wrote:
let s = encode (1.1 :: Float)
:t s
s :: Data.ByteString.Lazy.ByteString
s
LPS [\NUL\NUL\140\204\205\255\255\255\255\255\255\255\233]
decode s :: Float
1.1
But doesn't Data.Binary serialise to a guaranteed
Hello Jules,
Friday, June 1, 2007, 3:02:33 PM, you wrote:
machine-independent? Whereas this (stupid) question explicitly asked for
*your particular hardware's* floating point rep.
there is castSTUArray function which is widely used exactly for this
purpose. look for examples of its usage in
David Roundy wrote:
Note also that you can use unsafePerformIO to safely get pure functions
doing both these operations.
I've always been puzzled by this one... how does unsafePerformIO
circumvent the type system? I don't understand.
___
On Fri, Jun 01, 2007 at 07:28:07PM +0100, Andrew Coppin wrote:
David Roundy wrote:
Note also that you can use unsafePerformIO to safely get pure functions
doing both these operations.
I've always been puzzled by this one... how does unsafePerformIO
circumvent the type system? I don't
Donald Bruce Stewart wrote:
See also the older NewBinary,
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/NewBinary-0.1
Now that's just ironic...
Incidentally, I've been thinking. You *might* want the binary
representation of things if you were going to, say, compress or
David Roundy wrote:
On Fri, Jun 01, 2007 at 07:28:07PM +0100, Andrew Coppin wrote:
David Roundy wrote:
Note also that you can use unsafePerformIO to safely get pure functions
doing both these operations.
I've always been puzzled by this one... how does unsafePerformIO
On Fri, Jun 01, 2007 at 07:39:32PM +0100, Andrew Coppin wrote:
David Roundy wrote:
On Fri, Jun 01, 2007 at 07:28:07PM +0100, Andrew Coppin wrote:
David Roundy wrote:
Note also that you can use unsafePerformIO to safely get pure functions
doing both these operations.
I've
On Friday 01 June 2007, Andrew Coppin wrote:
David Roundy wrote:
Note also that you can use unsafePerformIO to safely get pure functions
doing both these operations.
I've always been puzzled by this one... how does unsafePerformIO
circumvent the type system? I don't understand.
import
David Roundy wrote:
On Fri, Jun 01, 2007 at 07:39:32PM +0100, Andrew Coppin wrote:
No, I mean... how could you use unsafePerformIO to perform a typecast? I
don't see a way to do that.
Then I'm confused. What typecast are you talking about?
cast :: a - b
cast x = unsafePerformIO (do
andrewcoppin:
Donald Bruce Stewart wrote:
See also the older NewBinary,
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/NewBinary-0.1
Now that's just ironic...
Incidentally, I've been thinking. You *might* want the binary
representation of things if you were going
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
(Obviously a pretty silly challenge, but hey.)
My first instinct was to use Data.Bits - but I see no instance for
Double. (Presumably because performing bitwise operations on a
On 31/05/07, Andrew Coppin [EMAIL PROTECTED] wrote:
If you're bored... can you come up with a solution to this?
Try using floatToDigits:
http://haskell.org/ghc/docs/latest/html/libraries/base/Numeric.html#v%3AfloatToDigits
floatToDigits takes a base and a non-negative RealFloat number, and
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote:
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
(Obviously a pretty silly challenge, but hey.)
I fail to see what this has to do with expressive power, which
it's
Tomasz Zielonka wrote:
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote:
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
(Obviously a pretty silly challenge, but hey.)
I fail to see what this has to do with
On Thursday 31 May 2007, Andrew Coppin wrote:
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
(Obviously a pretty silly challenge, but hey.)
With some help from int-e in irc:
{-# OPTIONS_GHC -fglasgow-exts #-}
import GHC.Base
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote:
My first instinct was to use Data.Bits - but I see no instance for
Double. (Presumably because performing bitwise operations on a Double is
a pretty odd thing to want to do.) So my next guess is to do some
bizzare type system
On Thu, May 31, 2007 at 08:47:28PM +0100, Andrew Coppin wrote:
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
(Obviously a pretty silly challenge, but hey.)
My first instinct was to use Data.Bits - but I see no instance for
On May 31, 2007, at 15:47 , Andrew Coppin wrote:
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
Is it me, or does this look like a job for Data.Binary?
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL
On 5/31/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On May 31, 2007, at 15:47 , Andrew Coppin wrote:
If you're bored... can you come up with a solution to this?
http://warp.povusers.org/ProgrammingChallenge.html
Is it me, or does this look like a job for Data.Binary?
It's not
On Thu, May 31, 2007 at 11:36:54PM +0200, Tomasz Zielonka wrote:
You can imitate the C++ code using the FFI libraries:
import Foreign.Storable
import Foreign
import Data.Word
import Data.Bits
getDoubleBits :: Double - IO String
getDoubleBits d = alloca $ \ptr -
23 matches
Mail list logo