diff --git a/Data/IntTrie.hs b/Data/IntTrie.hs
--- a/Data/IntTrie.hs
+++ b/Data/IntTrie.hs
@@ -32,14 +32,14 @@
 data BitTrie a = BitTrie a (BitTrie a) (BitTrie a)
 
 instance Functor BitTrie where
-    fmap f (BitTrie x l r) = BitTrie (f x) (fmap f l) (fmap f r)
+    fmap f ~(BitTrie x l r) = BitTrie (f x) (fmap f l) (fmap f r)
 
 instance Applicative BitTrie where
     pure x = fix (\g -> BitTrie x g g)
-    BitTrie f fl fr <*> BitTrie x xl xr = BitTrie (f x) (fl <*> xl) (fr <*> xr)
+    ~(BitTrie f fl fr) <*> ~(BitTrie x xl xr) = BitTrie (f x) (fl <*> xl) (fr <*> xr)
 
 instance Functor IntTrie where
-    fmap f (IntTrie neg z pos) = IntTrie (fmap f neg) (f z) (fmap f pos)
+    fmap f ~(IntTrie neg z pos) = IntTrie (fmap f neg) (f z) (fmap f pos)
 
 instance Applicative IntTrie where
     pure x = IntTrie (pure x) x (pure x)
@@ -48,17 +48,17 @@
 
 -- | Apply the trie to an argument.  This is the semantic map.
 apply :: (Ord b, Bits b) => IntTrie a -> b -> a
-apply (IntTrie neg z pos) x =
+apply ~(IntTrie neg z pos) x =
     case compare x 0 of
         LT -> applyPositive neg (-x)
         EQ -> z
         GT -> applyPositive pos x
 
 applyPositive :: (Bits b) => BitTrie a -> b -> a
-applyPositive (BitTrie one even odd) x
+applyPositive ~(BitTrie one even odd) x
     | x == 1 = one
-    | testBit x 0 = applyPositive odd (shift x (-1))
-    | otherwise   = applyPositive even (shift x (-1))
+    | testBit x 0 = applyPositive odd (x `shiftR` 1)
+    | otherwise   = applyPositive even (x `shiftR` 1)
 
 -- | The identity trie.  
 --
@@ -69,24 +69,24 @@
 identityPositive :: (Bits a) => BitTrie a
 identityPositive = go
     where
-    go = BitTrie 1 (fmap (\n -> shift n 1) go) (fmap (\n -> shift n 1 .|. 1) go)
+    go = BitTrie 1 (fmap (`shiftL` 1) go) (fmap (\n -> (n `shiftL` 1) .|. 1) go)
 
 -- | Modify the function at one point
 --
 -- > apply (modify x f t) i | i == x = f (apply t i)
 -- >                        | otherwise = apply t i
 modify :: (Ord b, Bits b) => b -> (a -> a) -> IntTrie a -> IntTrie a
-modify x f (IntTrie neg z pos) =
+modify x f ~(IntTrie neg z pos) =
     case compare x 0 of
         LT -> IntTrie (modifyPositive (-x) f neg) z pos
         EQ -> IntTrie neg (f z) pos
         GT -> IntTrie neg z (modifyPositive x f pos)
 
 modifyPositive :: (Bits b) => b -> (a -> a) -> BitTrie a -> BitTrie a
-modifyPositive x f (BitTrie one even odd)
+modifyPositive x f ~(BitTrie one even odd)
     | x == 1      = BitTrie (f one) even odd
-    | testBit x 0 = BitTrie one even (modifyPositive x f odd)
-    | otherwise   = BitTrie one (modifyPositive x f even) odd
+    | testBit x 0 = BitTrie one even (modifyPositive (x `shiftR` 1) f odd)
+    | otherwise   = BitTrie one (modifyPositive (x `shiftR` 1) f even) odd
 
 -- | Overwrite the function at one point
 --
diff --git a/data-inttrie.cabal b/data-inttrie.cabal
--- a/data-inttrie.cabal
+++ b/data-inttrie.cabal
@@ -1,7 +1,7 @@
 Name: data-inttrie
 Description:
     A simple lazy, infinite trie from integers.
-Version: 0.0.1
+Version: 0.0.2
 Stability: experimental
 Synopsis: A lazy, infinite trie of integers.
 License: BSD3
