ANN: data-dword: Long binary words from short ones

Mikhail Vorozhtsov mikhail.vorozhtsov at gmail.com
Thu Oct 11 08:06:51 CEST 2012


Hi.

I'm pleased to announce my new little library, data-dword[1]. It 
provides Template Haskell utilities for defining binary word data types 
from low and high halves, e.g.

data Word96 = Word96 Word32 Word64 -- strictness is configurable
data Int96 = Int96 Int32 Word64

-- All instances are fully implemented (including `quotRem`, etc)
instance Bounded, Enum, Eq, Integral, Num, Ord, Read,
          Real, Show, Ix, Bits, Hashable

-- Extra bit-manipulating functions, unwrapped addition and
-- multiplication, etc.
instance BinaryWord, DoubleWord

-- Rewrite rules for converting to/from the standard integral types
{-# RULES "fromIntegral/..." ... #-}

The library comes with a pretty thorough test suite (that ATM has some 
failures on x86-32 due to bug #7233[2] in the base library).

[1] http://hackage.haskell.org/package/data-dword
[2] http://hackage.haskell.org/trac/ghc/ticket/7233



More information about the Libraries mailing list