From d6dc6ef9112699c2950aaf4a04849c30b84ec4cc Mon Sep 17 00:00:00 2001
From: Liyang HU <git@liyang.hu>
Date: Tue, 7 Jun 2011 15:46:04 +0900
Subject: [PATCH 1/4] Moved data IntSet to Data.IntSet.Internal

---
 Data/IntSet.hs          |   21 ++-------------------
 Data/IntSet/Internal.hs |   21 +++++++++++++++++++++
 containers.cabal        |    2 ++
 3 files changed, 25 insertions(+), 19 deletions(-)
 create mode 100644 Data/IntSet/Internal.hs

diff --git a/Data/IntSet.hs b/Data/IntSet.hs
index bcc5104..7c95324 100644
--- a/Data/IntSet.hs
+++ b/Data/IntSet.hs
@@ -139,6 +139,8 @@ import GlaExts ( Word(..), Int(..), shiftRL# )
 import Data.Word
 #endif
 
+import Data.IntSet.Internal
+
 infixl 9 \\{-This comment teaches CPP correct behaviour -}
 
 -- A "Nat" is a natural machine word (an unsigned Int)
@@ -171,25 +173,6 @@ shiftRL x i   = shiftR x i
 (\\) :: IntSet -> IntSet -> IntSet
 m1 \\ m2 = difference m1 m2
 
-{--------------------------------------------------------------------
-  Types  
---------------------------------------------------------------------}
--- | A set of integers.
-data IntSet = Nil
-            | Tip {-# UNPACK #-} !Int
-            | Bin {-# UNPACK #-} !Prefix {-# UNPACK #-} !Mask !IntSet !IntSet
--- Invariant: Nil is never found as a child of Bin.
--- Invariant: The Mask is a power of 2.  It is the largest bit position at which
---            two elements of the set differ.
--- Invariant: Prefix is the common high-order bits that all elements share to
---            the left of the Mask bit.
--- Invariant: In Bin prefix mask left right, left consists of the elements that
---            don't have the mask bit set; right is all the elements that do.
-
-
-type Prefix = Int
-type Mask   = Int
-
 instance Monoid IntSet where
     mempty  = empty
     mappend = union
diff --git a/Data/IntSet/Internal.hs b/Data/IntSet/Internal.hs
new file mode 100644
index 0000000..4fe16b9
--- /dev/null
+++ b/Data/IntSet/Internal.hs
@@ -0,0 +1,21 @@
+module Data.IntSet.Internal {- export everything -} where
+
+{--------------------------------------------------------------------
+  Types
+--------------------------------------------------------------------}
+
+-- | A set of integers.
+data IntSet = Nil
+            | Tip {-# UNPACK #-} !Int
+            | Bin {-# UNPACK #-} !Prefix {-# UNPACK #-} !Mask !IntSet !IntSet
+-- Invariant: Nil is never found as a child of Bin.
+-- Invariant: The Mask is a power of 2.  It is the largest bit position at which
+--            two elements of the set differ.
+-- Invariant: Prefix is the common high-order bits that all elements share to
+--            the left of the Mask bit.
+-- Invariant: In Bin prefix mask left right, left consists of the elements that
+--            don't have the mask bit set; right is all the elements that do.
+
+type Prefix = Int
+type Mask   = Int
+
diff --git a/containers.cabal b/containers.cabal
index 72d1a10..9d6abef 100644
--- a/containers.cabal
+++ b/containers.cabal
@@ -29,6 +29,8 @@ Library {
         Data.IntSet
         Data.Map
         Data.Set
+    other-modules:
+        Data.IntSet.Internal
     include-dirs: include
     extensions: CPP
     if !impl(nhc98) {
-- 
1.7.4.1

