September 19, 2012
data-inttrie package is a simple lazy, infinite trie for integers. It is now available in Fedora. Install it using:
$ sudo yum install ghc-data-inttrie-devel
To import the data-inttrie module, use:
Prelude> :m + Data.IntTrie
The Bits class in Data.Bits module defines bitwise operations on integral types, and is defined using:
class Num a => Bits a where
The complement function, for example, reverses the bits in the argument:
Prelude> :m + Data.bits
Prelude Data.Bits> complement 3
-4
The apply function in Data.IntTrie applies a trie to an argument:
apply :: (Ord b, Bits b) => IntTrie a -> b -> a
For example:
Prelude Data.IntTrie> let bits f = apply (fmap f identity)
Prelude Data.IntTrie> bits (*3) 4 :: Int
12