packages/containers.git
7 years agoChange INLINE to INLINABLE on methods using Ord.
Milan Straka [Mon, 23 Apr 2012 13:54:13 +0000 (15:54 +0200)] 
Change INLINE to INLINABLE on methods using Ord.

As mentioned previously, INLINE - INLINABLE method chain does not result
in specialization, it has to be INLINABLE - INLINABLE.

7 years agoAdd benchmark of lookupGE to choose best implementation.
Milan Straka [Mon, 23 Apr 2012 08:57:45 +0000 (10:57 +0200)] 
Add benchmark of lookupGE to choose best implementation.

Most of the code is by Twan van Laarhoven, thanks.

7 years agoFix warnings.
Milan Straka [Mon, 23 Apr 2012 08:53:49 +0000 (10:53 +0200)] 
Fix warnings.

7 years agoMove SetOperations benchmark to its own subdirectory.
Milan Straka [Mon, 23 Apr 2012 08:02:12 +0000 (10:02 +0200)] 
Move SetOperations benchmark to its own subdirectory.

Also improve the infrastructure to handle benchmarks in different
subdirectories.

7 years agoManually inline {Map,IntMap}.map.
Milan Straka [Sun, 22 Apr 2012 16:06:21 +0000 (18:06 +0200)] 
Manually inline {Map,IntMap}.map.

7 years agoInline {Map,Set}.fold* when 2 arguments are given.
Milan Straka [Sun, 22 Apr 2012 16:00:43 +0000 (18:00 +0200)] 
Inline {Map,Set}.fold* when 2 arguments are given.

Inlining folds when 2 arguments are given is consistent
with Prelude.foldr and {IntMap,IntSeT}.fold*.

7 years agoRemove obsolete comment about deleteWith.
Milan Straka [Sun, 22 Apr 2012 15:54:00 +0000 (17:54 +0200)] 
Remove obsolete comment about deleteWith.

DeleteWith is no longer method of any collection.

7 years agoImprove heap-allocation by adding explicit type signatures.
Milan Straka [Sun, 22 Apr 2012 15:48:29 +0000 (17:48 +0200)] 
Improve heap-allocation by adding explicit type signatures.

When a local 'go' function is using methods from Ord dictionary,
this dictionary is heap-allocated at the entry to the outer function.
If it is given explicit type mentioning the Ord class, the dictionary is
passed on the stack, decreasing heap allocation.

7 years agoImprove Map indexing functions.
Milan Straka [Sat, 21 Apr 2012 20:14:42 +0000 (22:14 +0200)] 
Improve Map indexing functions.

* Manually inline findIndex and deleteAt to avoid allocation.

* Give type to local 'go' function of findIndex and lookupIndex
  to avoid heap allocation.

7 years agoImprove query functions of Map and Set.
Milan Straka [Sat, 21 Apr 2012 19:41:22 +0000 (21:41 +0200)] 
Improve query functions of Map and Set.

As documented in the Note: Local 'go' functions and capturing,
it is safe to use captured key argument in query functions.

Also, in order to decrease allocation, the query functions in Map
are manually inlined, so 'member' does not have to call 'lookup'
and heap-allocate 'Just a'.

Tests of query functions are much improved too.

7 years agoInsert missing space in an error message.
Milan Straka [Sat, 21 Apr 2012 19:37:14 +0000 (21:37 +0200)] 
Insert missing space in an error message.

7 years agoPrevent multiple warnings.
Milan Straka [Sat, 21 Apr 2012 18:25:00 +0000 (20:25 +0200)] 
Prevent multiple warnings.

Prevent multiple warnings caused by unsuccessful SpecConstr pass.
We do so by not inlining helper testing function.

7 years agoAdd empty line between Notes.
Milan Straka [Fri, 20 Apr 2012 18:26:47 +0000 (20:26 +0200)] 
Add empty line between Notes.

7 years agoInline Int{Map,Set}.{null, empty, singleton}.
Milan Straka [Fri, 20 Apr 2012 16:32:18 +0000 (18:32 +0200)] 
Inline Int{Map,Set}.{null, empty, singleton}.

These are probably inlined anyway, but we explicitly INLINE
them in Map and Set, so we do also in IntMap and IntSet for consistency.

7 years agoImprove query functions of IntMap and IntSet.
Milan Straka [Fri, 20 Apr 2012 16:18:55 +0000 (18:18 +0200)] 
Improve query functions of IntMap and IntSet.

As documented in the Note: Local 'go' functions and capturing,
it is safe to use captured key argument in query functions.

Also, in order to decrease allocation, the query functions in IntMap
are manually inlined, so 'member' does not have to call 'lookup'
and heap-allocate 'Just a'.

Tests of query functions are much improved too.

7 years agoReorder the data constructors of Map and Set.
Milan Straka [Fri, 20 Apr 2012 16:04:54 +0000 (18:04 +0200)] 
Reorder the data constructors of Map and Set.

The order of constructors has clearly no effect on corectness.

Inspired by the change in order of constructors of IntMap and IntSet,
the benchmark shows slight improvement when changing the data
constructors from Tip | Bin to Bin | Tip.

Also, we now consistently use the same order of constructors in all
these structures: Map, Set, IntMap, IntSet.

7 years agoImprove programming documentation.
Milan Straka [Fri, 20 Apr 2012 15:57:35 +0000 (17:57 +0200)] 
Improve programming documentation.

Move important programming comments to the beginning of the source file,
give them names and refer to the from the source code where necessarry.

7 years agoAdd forgotten GHC >= 7.0 condition in (!).
Milan Straka [Fri, 20 Apr 2012 15:43:14 +0000 (17:43 +0200)] 
Add forgotten GHC >= 7.0 condition in (!).

The INLINABLE pragma works only for GHC >= 7.0 and generates
warning for older compilers.

7 years agoMerge branch 'master' of github.com:haskell/containers
Milan Straka [Sat, 14 Apr 2012 17:04:41 +0000 (19:04 +0200)] 
Merge branch 'master' of github.com:haskell/containers

7 years agoImprove IntSet.{union, difference, intersection}.
Milan Straka [Sat, 14 Apr 2012 16:44:37 +0000 (18:44 +0200)] 
Improve IntSet.{union, difference, intersection}.

Incorporate improvements achieved in IntMap implementation by using
mergeWithKey' -- i.e., reorder and modify pattern matches of combining
functions, to play nicely with pattern match compiler. Also improve
the ``Tip vs Bin'' case handling.

7 years agoBenchmark of set operations -- union, difference, intersection.
Milan Straka [Sat, 14 Apr 2012 16:44:02 +0000 (18:44 +0200)] 
Benchmark of set operations -- union, difference, intersection.

7 years agoScripts for comparing csv results of benchmarks.
Milan Straka [Sat, 14 Apr 2012 16:40:31 +0000 (18:40 +0200)] 
Scripts for comparing csv results of benchmarks.

7 years agoAdd IntMap.mergeWithKey.
Milan Straka [Sat, 14 Apr 2012 14:55:46 +0000 (16:55 +0200)] 
Add IntMap.mergeWithKey.

The slightly more general internal function mergeWithKey' is used to
define both mergeWithKey and other combining functions union*,
difference*, intersection*.

The resulting implementations of union*, difference* and intersection*
are no slower than before, and up to 30% faster in case of two large
interleaved maps. Measured by benchmarks/SetOperations-IntMap.hs.

7 years agoMerge pull request #10 from batterseapower/master
Milan Straka [Fri, 30 Mar 2012 17:08:45 +0000 (10:08 -0700)] 
Merge pull request #10 from batterseapower/master

Add traverseWithKey to Map and IntMap API

7 years agoAdd traverseWithKey to Map and IntMap API
Max Bolingbroke [Fri, 30 Mar 2012 13:20:15 +0000 (14:20 +0100)] 
Add traverseWithKey to Map and IntMap API

Proposal reviewed and approved by the libraries list.
Particular thanks goes to Thomas Schilling for his suggestions
regarding how the function should be documented.

7 years agoAdd Makefile for manually building tests.
Milan Straka [Mon, 26 Mar 2012 14:37:48 +0000 (16:37 +0200)] 
Add Makefile for manually building tests.

7 years agoSmall benchmark changes.
Milan Straka [Mon, 26 Mar 2012 14:39:07 +0000 (16:39 +0200)] 
Small benchmark changes.

* Uncomment all working benchmarks.

* Use whnf instead of nf, as all containers are spine and key strict.

* Overhaul Makefile.

7 years agoMark Data.Map.(!) as INLINABLE instead of INLINE.
Milan Straka [Wed, 14 Mar 2012 17:30:43 +0000 (18:30 +0100)] 
Mark Data.Map.(!) as INLINABLE instead of INLINE.

This should have been done in commit 3f798e33. As mentioned in the
commit log, the chain
  m ! k = find k m
  {-# INLINE (!) #-}
  find k m = ...
  {-# INLINABLE find #-}
results in find not being specialized at the call site of (!).

7 years agoUpdate .gitignore.
Paolo Capriotti [Tue, 6 Mar 2012 10:57:33 +0000 (10:57 +0000)] 
Update .gitignore.

7 years agoImprove {Map,IntMap}.fold* tests.
Milan Straka [Sun, 4 Mar 2012 18:22:47 +0000 (19:22 +0100)] 
Improve {Map,IntMap}.fold* tests.

7 years agoFix Data.Sequence warnings.
Milan Straka [Sun, 4 Mar 2012 17:54:28 +0000 (18:54 +0100)] 
Fix Data.Sequence warnings.

As GHC HEAD found out, methods deep, node2, node3 were both
INLINE and SPECIALIZE. Make them INLINE only.

Also the -Wwarn option can be removed.

7 years agoImprove list fusion.
Milan Straka [Sun, 4 Mar 2012 15:29:42 +0000 (16:29 +0100)] 
Improve list fusion.

* Allow fusable methods to be converted back to the original call when
  no fusion happens. For that, foldlFB and foldrFB are used, inspired by
  mapFB from Prelude.

* Remove RULES for aliases like toList, assocs, elems, just INLINE them.

7 years agoImprove Int{Set,Map}.fold*.
Milan Straka [Sun, 4 Mar 2012 15:26:38 +0000 (16:26 +0100)] 
Improve Int{Set,Map}.fold*.

In the fold definitions, do not call go if the Bin constructor was
matched during the test for negative numbers. Instead, manually inline
that branch of go.

Otherwise GHC optimizer does this for us -- it creates local definition
of that branch of go and calls it. On my machine, it causes >200B growth
of object file, for every fold.

7 years agoImprove Int{Map,Set}.fold*.
Milan Straka [Sun, 4 Mar 2012 15:24:52 +0000 (16:24 +0100)] 
Improve Int{Map,Set}.fold*.

Improve Int{Map,Set}.fold* defitions to be inlinable with
two arguments only.

Otherwise GHC inlined toAscList, toDescList _and after that_ inlined
the fold, resulting in useless code growth.

7 years agoImprove IntMap.fold*.
Milan Straka [Sun, 4 Mar 2012 15:23:11 +0000 (16:23 +0100)] 
Improve IntMap.fold*.

Improve IntMap.fold* not to do two checks for negative numbers
-- both prefix and mask were tested. Mask tests are enough.

7 years agoImprove {Map,IntMap}.intersection* and its tests.
Milan Straka [Sat, 3 Mar 2012 10:28:18 +0000 (11:28 +0100)] 
Improve {Map,IntMap}.intersection* and its tests.

* Add tests for intersectionWith*.
* Add specific Map.intersection implementation instead of using
  Map.intersectionWithKey.
* Refactor Map.intersectionWithKey implementatioin.

7 years agoAdd toDescList.
Milan Straka [Mon, 12 Dec 2011 12:08:36 +0000 (13:08 +0100)] 
Add toDescList.

Add toDescList to IntMap, Set and IntSet. Also add
corresponding fusion RULES and tests.

The function is added as community was opposed to removing
toDescList from Map.

7 years agoImprove formatting of oneliners.
Milan Straka [Mon, 12 Dec 2011 11:12:42 +0000 (12:12 +0100)] 
Improve formatting of oneliners.

7 years agoImprove tests.
Milan Straka [Wed, 7 Dec 2011 19:47:48 +0000 (20:47 +0100)] 
Improve tests.

* Test IntMap.mapKeys, mapKeysWith, mapKeysMonotonic, which were just
  added.

* Unify map-properties and intmap-properties as possible, by renaming
  methods and changing comments, so that they are the same in both.

7 years agoAdd IntMap.mapKeys* methods.
Milan Straka [Wed, 7 Dec 2011 19:42:10 +0000 (20:42 +0100)] 
Add IntMap.mapKeys* methods.

Add IntMap.mapKeys, mapKeysWith, mapKeysMonotonic.
These functions are present in the Map module and we want IntMap
to be a replacement of Map Int.

The IntMap.mapKeysMonotonic is not as efficient as Map.mapKeysMonotonic
because of the IntMap representation -- the trie structure changes
wildly when the keys changes, even if the ordering of keys is not
altered.

Also, some time complexities were corrected.

7 years agoImprove performance of Map.mapKeys[With].
Milan Straka [Wed, 7 Dec 2011 19:38:57 +0000 (20:38 +0100)] 
Improve performance of Map.mapKeys[With].

We can manually fuse
  List.map fFirst . toList
    where fFirst (a, b) = (f a, b)
using the right fold as
  foldrWithKey (\k x xs -> (f k, x) : xs) []

7 years agoRemove unnecessary methods from Data.Map.Strict.
Milan Straka [Wed, 7 Dec 2011 19:05:36 +0000 (20:05 +0100)] 
Remove unnecessary methods from Data.Map.Strict.

Remove implementations of mapKeys and mapKeysMonotonic
from Data.Map.Strict module. These methods modify keys only
and even Data.Map.Lazy are strict in keys.

7 years agoGeneralize IntMap.update{Min,Max}[WithKey].
Milan Straka [Wed, 7 Dec 2011 18:54:43 +0000 (19:54 +0100)] 
Generalize IntMap.update{Min,Max}[WithKey].

Previously these methods were given an argument of type
  [Key ->] a -> a
Now they are given an argument of type
  [Key ->] a -> Maybe a
That makes them compatible with Map counterparts.

7 years agoUnify IntMap.deleteFind{Min,Max} with the Map ...
Milan Straka [Mon, 5 Dec 2011 21:33:18 +0000 (22:33 +0100)] 
Unify IntMap.deleteFind{Min,Max} with the Map ...

... counterparts.

The type signature has changed from
  IntMap.deleteFind{Min,Max} :: IntMap a -> (a, IntMap a)
to
  IntMap.deleteFind{Min,Max} :: IntMap a -> ((Key, a), IntMap a)
.

7 years agoInt{Set.Map}.delete{Min,Max} doesn't fail on empty.
Milan Straka [Mon, 5 Dec 2011 21:14:46 +0000 (22:14 +0100)] 
Int{Set.Map}.delete{Min,Max} doesn't fail on empty.

Make Int{Map,Set}.delete{Min,Max} behave like {Map,Set}.delete{Min,Max}.
* Old behaviour: Int{Set,Map}.delete{Min,Max} empty ==> error
* New behaviour: Int{Set,Map}.delete{Min,Max} empty ==  empty

7 years agoDisable ropt_plain_output.
Milan Straka [Fri, 2 Mar 2012 16:48:44 +0000 (17:48 +0100)] 
Disable ropt_plain_output.

The ropt_plain_output was used to disables ansi sequences in the test
log. But it works only for test-framework < 0.5.

In test-framework >= 0.5, ropt_plain_output no longer exists. The line
"ropt_color_mode = Just ColorNever" can be used, but test-framework >= 0.5
detects it is not writing to the terminal and disables ansi sequences by
itself.

It is difficult to compile ropt_plain_output conditionally for
test-framework < 0.5 only (MIN_VERSION_* macros are not defined for
dependencies of tests, conditions in cabal tests do not work for
ghc-7.0). We therefore do not set ropt_plain_output and live with ansi
sequences in test logs produces by test-framework < 0.5.

8 years agoFix GHC HEAD build breakages
Johan Tibell [Wed, 18 Jan 2012 16:52:26 +0000 (08:52 -0800)] 
Fix GHC HEAD build breakages

GHC HEAD adds a warning for SPECIALISE pragmas that will never fire
and Data.Sequence contains such a pragma.

8 years agoMerge pull request #6 from bovinespirit/master
Milan Straka [Sun, 25 Dec 2011 11:36:25 +0000 (03:36 -0800)] 
Merge pull request #6 from bovinespirit/master

Remove NFData instances from benchmark code

8 years agoRemove NFData instances from benchmarks
Matt West [Sat, 24 Dec 2011 20:52:29 +0000 (20:52 +0000)] 
Remove NFData instances from benchmarks

8 years agoMerge pull request #5 from hvr/master-ghc74fixups
Milan Straka [Tue, 20 Dec 2011 07:05:30 +0000 (23:05 -0800)] 
Merge pull request #5 from hvr/master-ghc74fixups

Relax build deps to allow GHC-7.4's deepseq-1.3.0

8 years agoRelax build deps to allow GHC-7.4's deepseq-1.3.0
Herbert Valerio Riedel [Mon, 19 Dec 2011 18:00:20 +0000 (19:00 +0100)] 
Relax build deps to allow GHC-7.4's deepseq-1.3.0

8 years agoAllow test-suites to work with GHC < 7.0.
Milan Straka [Thu, 1 Dec 2011 21:33:03 +0000 (22:33 +0100)] 
Allow test-suites to work with GHC < 7.0.

Due to several problems with older versions of GHC and Cabal,
some extensions have to be switched unconditionaly in test-suites
to allow GHC < 7.0 to work.

The reason is
* GHC < 7.0 cannot handle conditional LANGUAGE pragmas and therefore
  the extensions have to be specified in cabal file.
* GHC = 7.0 with bundled Cabal cannot handle conditionals in
  test-suites and so we cannot enable the extensions conditionally.

When testing with GHC < 7.0 is no longer necessary, the extensions
in test-suites can be removed.

8 years agoImprovements of test-suites compilation.
Milan Straka [Wed, 30 Nov 2011 21:20:23 +0000 (22:20 +0100)] 
Improvements of test-suites compilation.

Previously the test-suites could be compiled only when a special
testing version of the library was built using -ftesting flag.
As commented by Duncan, that is bad -- users which enable testing
by default would install the testing version of library.

Now the test-suites do not link against the whole containers,
but compiles the necessary modules separately, with special testing
flags.

8 years agoAdd NFData instances ...
Milan Straka [Tue, 29 Nov 2011 21:25:55 +0000 (22:25 +0100)] 
Add NFData instances ...

... for Data.Graph.SCC and Data.Sequence.Seq.

8 years agoFix compilation with ghc-6.12.
Milan Straka [Tue, 29 Nov 2011 08:59:35 +0000 (09:59 +0100)] 
Fix compilation with ghc-6.12.

GHC < 7.0 cannot handle conditional pragmas, which we use.
Therefore for GHC < 7.0, the extensions are specified in the cabal file.
When GHC < 7.0 obsoletes, we will remove them.

8 years agoAdd list fusion RULES for keys and elems.
Milan Straka [Mon, 28 Nov 2011 11:40:37 +0000 (12:40 +0100)] 
Add list fusion RULES for keys and elems.

8 years agoOverhaul INLINE and INLINABLE in Map and Set.
Milan Straka [Fri, 25 Nov 2011 14:55:06 +0000 (15:55 +0100)] 
Overhaul INLINE and INLINABLE in Map and Set.

* Rename INLINEABLE -> INLINABLE
  Though both work, the latter is the preferred according the docs.

* Remove INLINABLE on methods not using type classes, as INLINABLE has
  real effect only on functions that use type classes (they get
  specialised in the call-site module).

  It also allows worker-wrapper transform on functions not marked
  INLINABLE (which surprisingly did not happen with INLINABLE).

* In GHC, INLINing the INLINABLE method as in
    update f = updateWithKey (\_ x -> f x)
    {-# INLINE update #-}
    updateWithKey = ...
    {-# INLINABLE updateWithKey #-}
  does not produce wanted result -- the updateWithKey does not get
  specialized in the call-site module.

  The solution is to mark both functions INLINABLE.

* Mark trivial functions as INLINE.

8 years agoMark all modules using GHC.Exts as Trustworthy.
Milan Straka [Fri, 25 Nov 2011 14:26:56 +0000 (15:26 +0100)] 
Mark all modules using GHC.Exts as Trustworthy.

GHC.Exts has been marked Unsafe in the base.

8 years agoAdd BangPatterns to IntSet.
Milan Straka [Fri, 25 Nov 2011 14:20:07 +0000 (15:20 +0100)] 
Add BangPatterns to IntSet.

The bang pattern is used to bind local literal of type Addr#.
GHC 7.0 allowed it without the extension, GHC 7.3 fails without it.

8 years agoAdd forgotten findWithDefault to IntMap.Strict.
Milan Straka [Fri, 25 Nov 2011 13:07:24 +0000 (14:07 +0100)] 
Add forgotten findWithDefault to IntMap.Strict.

8 years agoRemove unused code.
Milan Straka [Fri, 25 Nov 2011 13:01:48 +0000 (14:01 +0100)] 
Remove unused code.

8 years agoUpdate the documentation of strictness properties.
Milan Straka [Fri, 25 Nov 2011 12:41:26 +0000 (13:41 +0100)] 
Update the documentation of strictness properties.

* Document the strictness of keys in Map.Lazy and IntMap.Lazy.

* Document the strictness properties of IntMap.Strict.

* Document the strictness of keys in Set and IntSet.

* Unify various module descriptions accross Map, Set, Int{Map,Set}.

8 years agoFix warnings by renaming build -> create.
Milan Straka [Fri, 25 Nov 2011 09:42:12 +0000 (10:42 +0100)] 
Fix warnings by renaming build -> create.

8 years agoImprove fusion rules.
Milan Straka [Thu, 24 Nov 2011 19:08:52 +0000 (20:08 +0100)] 
Improve fusion rules.

* Add fusion rule for Data.IntMap.toAscList.

* Remove the GHC >= 503 condition.

* Make assocs, elems and toList call toAscList.

* Improve documentation of assocs, elems, toList, toAscList.

8 years agoImplement list fusion for {Int,}{MapSet}
Joachim Breitner [Wed, 21 Sep 2011 18:17:17 +0000 (20:17 +0200)] 
Implement list fusion for {Int,}{MapSet}

I am not fully convinced that it works well with the INLINEABLE pragmas,
but it won’t do harm this way either.

8 years agoIntMap refactoring.
Milan Straka [Thu, 24 Nov 2011 16:12:48 +0000 (17:12 +0100)] 
IntMap refactoring.

* Remove top-level *Unsigned top-level methods and use
  local definitions instead.

* Remove top-level split' and splitLookup' and use local
  definitions instead.

8 years agoRemove obsolete stuff from Data.Map.Base.
Milan Straka [Thu, 24 Nov 2011 15:12:56 +0000 (16:12 +0100)] 
Remove obsolete stuff from Data.Map.Base.

8 years agoExtensions are now maintained per-file.
Milan Straka [Thu, 24 Nov 2011 15:03:07 +0000 (16:03 +0100)] 
Extensions are now maintained per-file.

We drop the cabal support for extensions and instead list
all needed extensions in the file needing them.

It is a bit ugly, but feels better. We can now compile individual
files without cabal support (i.e., we can do ghci file).

8 years agoSpaces at end of lines removed.
Milan Straka [Thu, 24 Nov 2011 13:49:12 +0000 (14:49 +0100)] 
Spaces at end of lines removed.

Since my Google internship I am annoyed by spaced before end of lines
as vim shows them in red color.

8 years agoRefactor and improve seq-properties.
Milan Straka [Thu, 24 Nov 2011 11:49:39 +0000 (12:49 +0100)] 
Refactor and improve seq-properties.

* Use test-framework as the rest of the testsuite.

* Move testing-related code from Data.Sequence to seq-properties.

8 years agoModify map and intmap tests to use test-framework.
Milan Straka [Wed, 23 Nov 2011 20:56:41 +0000 (21:56 +0100)] 
Modify map and intmap tests to use test-framework.

The old manually-run QuickCheck methods are run by
test-framework now, because the framework can suppress
noisy output and also return non-zero exitcode on error.
Also duplicated properties were removed.

8 years agoUpdated errorneous documentation.
Milan Straka [Wed, 23 Nov 2011 20:17:20 +0000 (21:17 +0100)] 
Updated errorneous documentation.

Comments to update{Min,Max}[WithKey] were previously taken from
Data.Map and were wrong.

In Data.Map, the update function returns Maybe and possibly removes the
value.  But Data.IntMap version returns only the value and cannot cause
the maximum to be removed.

8 years agoImprove docs of mapKeys.
Milan Straka [Wed, 23 Nov 2011 19:39:23 +0000 (20:39 +0100)] 
Improve docs of mapKeys.

The problem found out when improving tests.

8 years agoCabalize set and intset tests.
Milan Straka [Wed, 23 Nov 2011 15:57:06 +0000 (16:57 +0100)] 
Cabalize set and intset tests.

Use test-framework, which suppresses noisy QuickCheck output,
prints a nice summary and returns non-zero exitcode on failure.

Also the set tests were improved using several intset properties.

8 years agoSmall changes to compile flags.
Milan Straka [Wed, 23 Nov 2011 16:11:30 +0000 (17:11 +0100)] 
Small changes to compile flags.

* ghc-prim is available since 6.10, was part of base before
* -fregs-graph is activated by -O2 since ghc 7.0 and had
  performance issues before that. Reference: ticket #2790.

8 years agoMove GHC testing framework tests to separate dir.
Milan Straka [Wed, 23 Nov 2011 14:43:33 +0000 (15:43 +0100)] 
Move GHC testing framework tests to separate dir.

8 years ago-Wall police
Johan Tibell [Tue, 22 Nov 2011 18:33:50 +0000 (10:33 -0800)] 
-Wall police

8 years agoRemove unused language pragmas
Johan Tibell [Tue, 22 Nov 2011 18:31:18 +0000 (10:31 -0800)] 
Remove unused language pragmas

8 years agoWhitespace only
Johan Tibell [Tue, 22 Nov 2011 18:29:52 +0000 (10:29 -0800)] 
Whitespace only

8 years agoMove most of D.IM.Lazy to D.IM.Base
Johan Tibell [Tue, 22 Nov 2011 18:29:38 +0000 (10:29 -0800)] 
Move most of D.IM.Lazy to D.IM.Base

8 years agoMerge branch 'dense-intset'
Milan Straka [Tue, 22 Nov 2011 18:00:26 +0000 (19:00 +0100)] 
Merge branch 'dense-intset'

Conflicts:
containers.cabal

8 years agoSplit test sections into lazy/strict
Johan Tibell [Tue, 22 Nov 2011 16:02:40 +0000 (08:02 -0800)] 
Split test sections into lazy/strict

8 years agoRename D.Pair to D.StrictPair
Johan Tibell [Tue, 22 Nov 2011 00:50:00 +0000 (16:50 -0800)] 
Rename D.Pair to D.StrictPair

8 years agoRemove unexported D.IntMap.Lazy.insertWithKey'
Johan Tibell [Tue, 22 Nov 2011 00:48:13 +0000 (16:48 -0800)] 
Remove unexported D.IntMap.Lazy.insertWithKey'

8 years agoFix language pragma in D.IntMap
Johan Tibell [Tue, 22 Nov 2011 00:45:29 +0000 (16:45 -0800)] 
Fix language pragma in D.IntMap

8 years agoRemove two remaining bang patterns
Johan Tibell [Tue, 22 Nov 2011 00:44:32 +0000 (16:44 -0800)] 
Remove two remaining bang patterns

8 years agoD.IntMap.Strict.mapEitherWithKey: Make spine strict
Johan Tibell [Mon, 21 Nov 2011 16:47:03 +0000 (08:47 -0800)] 
D.IntMap.Strict.mapEitherWithKey: Make spine strict

8 years agoDon't use bang patterns in D.IntMap.Strict
Johan Tibell [Mon, 21 Nov 2011 16:44:56 +0000 (08:44 -0800)] 
Don't use bang patterns in D.IntMap.Strict

8 years agoUse strictPair everywhere
Johan Tibell [Mon, 21 Nov 2011 16:38:43 +0000 (08:38 -0800)] 
Use strictPair everywhere

8 years agoDon't use bang patterns
Johan Tibell [Mon, 21 Nov 2011 16:16:33 +0000 (08:16 -0800)] 
Don't use bang patterns

8 years agoImprove performance of size.
Milan Straka [Mon, 21 Nov 2011 10:50:13 +0000 (11:50 +0100)] 
Improve performance of size.

Inlining recursive bitcount leads to unnecessary heap allocation
for every call to bitcount.

When a bitcount just calls recursive function, heap allocation is
avoided. (This is common issue of inlining recursive functions in GHC.)

8 years agoRemove obsolete IntMap tests
Johan Tibell [Mon, 21 Nov 2011 06:35:43 +0000 (22:35 -0800)] 
Remove obsolete IntMap tests

8 years agoRemove tests for deprecated functions
Johan Tibell [Mon, 21 Nov 2011 06:32:30 +0000 (22:32 -0800)] 
Remove tests for deprecated functions

8 years agoBuild map-properties using Cabal
Johan Tibell [Mon, 21 Nov 2011 06:19:01 +0000 (22:19 -0800)] 
Build map-properties using Cabal

8 years agoDon't deprecate the whole of Data.Map
Johan Tibell [Mon, 21 Nov 2011 04:30:17 +0000 (20:30 -0800)] 
Don't deprecate the whole of Data.Map

8 years agoFix warnings in IntSet.hs.
Milan Straka [Sat, 19 Nov 2011 11:23:33 +0000 (12:23 +0100)] 
Fix warnings in IntSet.hs.

Mostly usual shadowing issues.

8 years agoImprove performance of folds.
Milan Straka [Sat, 19 Nov 2011 09:54:06 +0000 (10:54 +0100)] 
Improve performance of folds.

We use wordsize-dependent implementation for GHC, for both
32-bit and 64-bit architectures.

It is based on fast constant-time implementation of indexOfTheOnlyBit,
which computes index of the only bit set in a word, suggested
by Edward Kmett.

Using that we can enumerate indexes of 1 bits, in the order from
LSB to MSB. That results in fast foldl implementations.

Foldr implementations bit-reverse the word and then iterate from the LSB
to MSB using accumulator. That is faster then either not using
accumulator or iterating from MSB to LSB.

8 years agoImproved the internal IntSet API and IntSet tests.
Milan Straka [Thu, 17 Nov 2011 20:37:12 +0000 (21:37 +0100)] 
Improved the internal IntSet API and IntSet tests.

* Changed internal functions lowTipBits and highTipBits to
  prefixOf, suffixOf and bitmapOf.

* Use uncheckedShift[R]L# instead of Data.Bits.shift and
  Ghc.Exts shift[R]L# to achieve unchecked shifts.

* Improve implementations if split, splitMember, minView, maxView.

* Improved tests -- some properties and conditions were added.

8 years agoAdd dependency on ghc-prim for impl(ghc).
Milan Straka [Wed, 16 Nov 2011 18:20:32 +0000 (19:20 +0100)] 
Add dependency on ghc-prim for impl(ghc).

Also perform some reformatting -- remove explicit brackets
and shuffle the content so that properties are grouped in one place.

8 years agoDo not export foldrBits for testing.
Milan Straka [Wed, 16 Nov 2011 18:03:43 +0000 (19:03 +0100)] 
Do not export foldrBits for testing.

It is not being used while testing.