This is the root directory of the "Buggy NoFib Haskell benchmark suite".

It is a 'buggy' version of the nofib collection of Haskell
programs that can be used to test debugging tools. 

All programs contain one of these bugs:
- a bug that produces an incorrect result
- a bug that produces non-termination
- a bug that produces an exception (e.g., div by zero)

Those files which contain a bug have a header as follows:

---------------------------------------------------------
--       WARNING: THIS PROGRAM CONTAINS A BUG!!!       --
--                                                     --
--  This program belongs to the faulty nofib library   --
--      and contains a bug to benchmark debuggers      --
--                                                     --
---------------------------------------------------------
--                                                     --
--  "The faulty nofib library" is a  collection of     --
--  Haskell programs from the 'nofib' benchmark suite  --
--                                                     --
--  Faults are always marked with a comment: "BUG"     --
--  The commented correct line appears after the       --
--  faulty line marked with "CORRECT"                  --
--                                                     --
--  We welcome any comment or improvement about        --
--  bugs. You can send them to:                        --
--        Josep Silva (jsilva@dsic.upv.es)             --
--                                                     --
---------------------------------------------------------
--                                                     --
--  There are three kinds of bugs depending on their   --
--  consequences:                                      --
--  1) Bugs that produce an incorrect result           --
--  2) Bugs that produce non-termination               --
--  3) Bugs that produce an exception (e.g. div by 0)  --
--                                                     --
--  This program contains a bug of tipe 1              --
---------------------------------------------------------

Those lines which contain a bug are preceded by:
"-- BUG: The following line contains a bug:"
and they are followed by the corrected statement 

As an example:

-- BUG: The following line contains a bug:
  map (zipWith (\n x -> if n then -x else x) (iterate not True)) powers
-- CORRECT --   map (zipWith (\n x -> if n then x else -x) (iterate not True)) powers

------------------------------------------------------------------------------


This repo should be part of a GHC source tree, that is the 'nofib' directory
should be at the same level in the tree as 'compiler' and 'libraries'.

To run the tests:

  $ make clean
  $ make boot
  $ make 2>&1 | tee nofib-log

will put the results in the file 'nofib-log'.

To compare the results of multiple runs, use the program in
../utils/nofib-analyse.  Something like this:

  $ nofib-analyse nofib-log-6.4.2 nofib-log-6.6

to generate a comparison of the runs in captured in 'nofib-log-6.4.2'
and 'nofib-log-6.6'.  When making comparisons, be careful to ensure
that the things that changed between the builds are only the things
that you *wanted* to change.  There are lots of variables: machine,
GHC version, GCC version, C libraries, static vs. dynamic GMP library,
build options, run options, and probably lots more.  To be on the safe
side, make both runs on the same unloaded machine.

To get instruction counts, memory reads/writes, and "cache misses",
you'll need to get hold of Cachegrind, which is part of Valgrind
(http://valgrind.org).

There are some options you might want to tweak; search for nofib in
../mk/config.mk, and override settings in ../mk/build.mk as usual.
