#3041: Arch independent binary representations
-----------------------------+----------------------------------------------
Reporter: nomeata | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Testcase:
Os: Linux | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
Comment (by kaol):
I'd use this, to add some error checking.
{{{
instance Binary Int where
put_ bh i = if i < (minBound::Int32) || i > (maxBound::Int32)
then error "Binary.instance Binary Int: Int out of bounds
for Int32"
else put_ bh (fromIntegral i :: Int32)
get bh = do
x <- get bh
return $! (fromIntegral (x :: Int32))
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3041#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs