Add instance Storable Ordering

Dannyu NDos ndospark320 at gmail.com
Tue Oct 8 09:08:48 UTC 2019


I don't know exact sementics of Storable, but it's addable anyway.

instance Storable
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#Storable>
Ordering where   sizeOf
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#sizeOf>
_          = sizeOf
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#sizeOf>
(undefined <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Err.html#undefined>::HTYPE_INT)
  alignment <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#alignment>
_       = alignment
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#alignment>
(undefined <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Err.html#undefined>::HTYPE_INT)
  peekElemOff <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#peekElemOff>
p <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097926>
i <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097927>
  = liftM <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Base.html#liftM>
(`compare` (1::HTYPE_INT)) $
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#peekElemOff>
peekElemOff (castPtr p) i   pokeElemOff
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#pokeElemOff>
p <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097928>
i <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097929>
x <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097930>
= pokeElemOff <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#pokeElemOff>
(castPtr <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Ptr.html#castPtr>
p <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097928>)
i <http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097929>
(fromIntegral (fromEnum x
<http://hackage.haskell.org/package/base-4.12.0.0/docs/src/Foreign.Storable.html#local-6989586621679097930>)::HTYPE_INT)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191008/f982ec78/attachment.html>


More information about the Libraries mailing list