{-# OPTIONS -cpp -fglasgow-exts #-}
---------------------------------------------------------------------------------
-{-| Module : Data.IntMap
- Copyright : (c) Daan Leijen 2002
- License : BSD-style
- Maintainer : libraries@haskell.org
- Stability : provisional
- Portability : portable
-
- An efficient implementation of maps from integer keys to values.
-
- This module is intended to be imported @qualified@, to avoid name
- clashes with Prelude functions. eg.
-
- > import Data.IntMap as Map
-
- The implementation is based on /big-endian patricia trees/. This data structure
- performs especially well on binary operations like 'union' and 'intersection'. However,
- my benchmarks show that it is also (much) faster on insertions and deletions when
- compared to a generic size-balanced map implementation (see "Map" and "Data.FiniteMap").
-
- * Chris Okasaki and Andy Gill, \"/Fast Mergeable Integer Maps/\",
- Workshop on ML, September 1998, pages 77--86, <http://www.cse.ogi.edu/~andy/pub/finite.htm>
-
- * D.R. Morrison, \"/PATRICIA -- Practical Algorithm To Retrieve Information
- Coded In Alphanumeric/\", Journal of the ACM, 15(4), October 1968, pages 514--534.
+-----------------------------------------------------------------------------
+-- Module : Data.IntMap
+-- Copyright : (c) Daan Leijen 2002
+-- License : BSD-style
+-- Maintainer : libraries@haskell.org
+-- Stability : provisional
+-- Portability : portable
+--
+-- An efficient implementation of maps from integer keys to values.
+--
+-- This module is intended to be imported @qualified@, to avoid name
+-- clashes with "Prelude" functions. eg.
+--
+-- > import Data.IntMap as Map
+--
+-- The implementation is based on /big-endian patricia trees/. This data
+-- structure performs especially well on binary operations like 'union'
+-- and 'intersection'. However, my benchmarks show that it is also
+-- (much) faster on insertions and deletions when compared to a generic
+-- size-balanced map implementation (see "Data.Map" and "Data.FiniteMap").
+--
+-- * Chris Okasaki and Andy Gill, \"/Fast Mergeable Integer Maps/\",
+-- Workshop on ML, September 1998, pages 77-86,
+-- <http://www.cse.ogi.edu/~andy/pub/finite.htm>
+--
+-- * D.R. Morrison, \"/PATRICIA -- Practical Algorithm To Retrieve
+-- Information Coded In Alphanumeric/\", Journal of the ACM, 15(4),
+-- October 1968, pages 514-534.
+--
+-- Many operations have a worst-case complexity of /O(min(n,W))/.
+-- This means that the operation can become linear in the number of
+-- elements with a maximum of /W/ -- the number of bits in an 'Int'
+-- (32 or 64).
+-----------------------------------------------------------------------------
- Many operations have a worst-case complexity of /O(min(n,W))/. This means that the
- operation can become linear in the number of elements
- with a maximum of /W/ -- the number of bits in an 'Int' (32 or 64).
--}
----------------------------------------------------------------------------------
module Data.IntMap (
-- * Map type
IntMap, Key -- instance Eq,Show
{-# OPTIONS -cpp -fglasgow-exts #-}
---------------------------------------------------------------------------------
-{-| Module : Data.IntSet
- Copyright : (c) Daan Leijen 2002
- License : BSD-style
- Maintainer : libraries@haskell.org
- Stability : provisional
- Portability : portable
-
- An efficient implementation of integer sets.
-
- This module is intended to be imported @qualified@, to avoid name
- clashes with Prelude functions. eg.
-
- > import Data.IntSet as Set
-
- The implementation is based on /big-endian patricia trees/. This data structure
- performs especially well on binary operations like 'union' and 'intersection'. However,
- my benchmarks show that it is also (much) faster on insertions and deletions when
- compared to a generic size-balanced set implementation (see "Set").
-
- * Chris Okasaki and Andy Gill, \"/Fast Mergeable Integer Maps/\",
- Workshop on ML, September 1998, pages 77--86, <http://www.cse.ogi.edu/~andy/pub/finite.htm>
-
- * D.R. Morrison, \"/PATRICIA -- Practical Algorithm To Retrieve Information
- Coded In Alphanumeric/\", Journal of the ACM, 15(4), October 1968, pages 514--534.
+-----------------------------------------------------------------------------
+-- |
+-- Module : Data.IntSet
+-- Copyright : (c) Daan Leijen 2002
+-- License : BSD-style
+-- Maintainer : libraries@haskell.org
+-- Stability : provisional
+-- Portability : portable
+--
+-- An efficient implementation of integer sets.
+--
+-- This module is intended to be imported @qualified@, to avoid name
+-- clashes with "Prelude" functions. eg.
+--
+-- > import Data.IntSet as Set
+--
+-- The implementation is based on /big-endian patricia trees/. This data
+-- structure performs especially well on binary operations like 'union'
+-- and 'intersection'. However, my benchmarks show that it is also
+-- (much) faster on insertions and deletions when compared to a generic
+-- size-balanced set implementation (see "Data.Set").
+--
+-- * Chris Okasaki and Andy Gill, \"/Fast Mergeable Integer Maps/\",
+-- Workshop on ML, September 1998, pages 77-86,
+-- <http://www.cse.ogi.edu/~andy/pub/finite.htm>
+--
+-- * D.R. Morrison, \"/PATRICIA -- Practical Algorithm To Retrieve
+-- Information Coded In Alphanumeric/\", Journal of the ACM, 15(4),
+-- October 1968, pages 514-534.
+--
+-- Many operations have a worst-case complexity of /O(min(n,W))/.
+-- This means that the operation can become linear in the number of
+-- elements with a maximum of /W/ -- the number of bits in an 'Int'
+-- (32 or 64).
+-----------------------------------------------------------------------------
- Many operations have a worst-case complexity of /O(min(n,W))/. This means that the
- operation can become linear in the number of elements
- with a maximum of /W/ -- the number of bits in an 'Int' (32 or 64).
--}
----------------------------------------------------------------------------------}
module Data.IntSet (
-- * Set type
IntSet -- instance Eq,Show
---------------------------------------------------------------------------------
-{-| Module : Data.Map
- Copyright : (c) Daan Leijen 2002
- License : BSD-style
- Maintainer : libraries@haskell.org
- Stability : provisional
- Portability : portable
-
- An efficient implementation of maps from keys to values (dictionaries).
-
- This module is intended to be imported @qualified@, to avoid name
- clashes with Prelude functions. eg.
-
- > import Data.Map as Map
-
- The implementation of "Map" is based on /size balanced/ binary trees (or
- trees of /bounded balance/) as described by:
-
- * Stephen Adams, \"/Efficient sets: a balancing act/\", Journal of Functional
- Programming 3(4):553-562, October 1993, <http://www.swiss.ai.mit.edu/~adams/BB>.
+-----------------------------------------------------------------------------
+-- |
+-- Module : Data.Map
+-- Copyright : (c) Daan Leijen 2002
+-- License : BSD-style
+-- Maintainer : libraries@haskell.org
+-- Stability : provisional
+-- Portability : portable
+--
+-- An efficient implementation of maps from keys to values (dictionaries).
+--
+-- This module is intended to be imported @qualified@, to avoid name
+-- clashes with Prelude functions. eg.
+--
+-- > import Data.Map as Map
+--
+-- The implementation of 'Map' is based on /size balanced/ binary trees (or
+-- trees of /bounded balance/) as described by:
+--
+-- * Stephen Adams, \"/Efficient sets: a balancing act/\",
+-- Journal of Functional Programming 3(4):553-562, October 1993,
+-- <http://www.swiss.ai.mit.edu/~adams/BB>.
+--
+-- * J. Nievergelt and E.M. Reingold,
+-- \"/Binary search trees of bounded balance/\",
+-- SIAM journal of computing 2(1), March 1973.
+-----------------------------------------------------------------------------
- * J. Nievergelt and E.M. Reingold, \"/Binary search trees of bounded balance/\",
- SIAM journal of computing 2(1), March 1973.
--}
-----------------------------------------------------------------------------------
module Data.Map (
-- * Map type
Map -- instance Eq,Show
-{-| Module : Data.Set
- Copyright : (c) Daan Leijen 2002
- License : BSD-style
- Maintainer : libraries@haskell.org
- Stability : provisional
- Portability : portable
-
- An efficient implementation of sets.
-
- This module is intended to be imported @qualified@, to avoid name
- clashes with Prelude functions. eg.
-
- > import Data.Set as Set
-
- The implementation of "Set" is based on /size balanced/ binary trees (or
- trees of /bounded balance/) as described by:
-
- * Stephen Adams, \"/Efficient sets: a balancing act/\", Journal of Functional
- Programming 3(4):553-562, October 1993, <http://www.swiss.ai.mit.edu/~adams/BB>.
-
- * J. Nievergelt and E.M. Reingold, \"/Binary search trees of bounded balance/\",
- SIAM journal of computing 2(1), March 1973.
+-----------------------------------------------------------------------------
+-- |
+-- Module : Data.Set
+-- Copyright : (c) Daan Leijen 2002
+-- License : BSD-style
+-- Maintainer : libraries@haskell.org
+-- Stability : provisional
+-- Portability : portable
+--
+-- An efficient implementation of sets.
+--
+-- This module is intended to be imported @qualified@, to avoid name
+-- clashes with "Prelude" functions. eg.
+--
+-- > import Data.Set as Set
+--
+-- The implementation of 'Set' is based on /size balanced/ binary trees (or
+-- trees of /bounded balance/) as described by:
+--
+-- * Stephen Adams, \"/Efficient sets: a balancing act/\",
+-- Journal of Functional Programming 3(4):553-562, October 1993,
+-- <http://www.swiss.ai.mit.edu/~adams/BB>.
+--
+-- * J. Nievergelt and E.M. Reingold,
+-- \"/Binary search trees of bounded balance/\",
+-- SIAM journal of computing 2(1), March 1973.
+--
+-- Note that the implementation is /left-biased/ -- the elements of a
+-- first argument are always perferred to the second, for example in
+-- 'union' or 'insert'. Of course, left-biasing can only be observed
+-- when equality is an equivalence relation instead of structural
+-- equality.
+-----------------------------------------------------------------------------
- Note that the implementation is /left-biased/ -- the elements of a
- first argument are always perferred to the second, for example in
- 'union' or 'insert'. Of course, left-biasing can only be observed
- when equality an equivalence relation instead of structural
- equality.
--}
----------------------------------------------------------------------------------
module Data.Set (
-- * Set type
Set -- instance Eq,Show