Make Data.List.Inits fast

Fixes #9345. Use a modified banker's queue to achieve amortized optimal
performance for inits. The previous implementation was extremely slow.

Reviewed By: nomeata, ekmett, austin

Differential Revision: https://phabricator.haskell.org/D329

(cherry picked from cde3a77f9703966145cae481ee35f52dcca2cf7d)
Filter out null bytes from trace, and warn accordingly, fixing #9395.

Summary:
Previously, if you ran trace "foo\0bar", the output was truncated so
that everything after the null byte was omitted.  This was terrible.
Now we filter out null bytes, and emit an extra trace saying that
null bytes were filtered out.

NB: we CANNOT fix debugBelch, because all printf variants *always*
respect null bytes, even if you're using string precision such as
%.*s.  The alternative would have been to introduce a new function
debugRawBelch which did not use format strings and took an explicit
string length, but I decided we generally should avoid putting null
bytes in our trace messages, and warn the user.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: hvr, austin

Subscribers: simonmar, relrod, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D121

GHC Trac Issues: #9395
Fix base component of #9423

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix build due to missing scanl'

This was sitting in my working tree, and I forgot to commit it. Oops.

This is not exported by Data.List, since it's only needed by 'inits'

Signed-off-by: Austin Seipp <austin@well-typed.com>
Revert "Fix base component of #9423"

This reverts commit fb2cbec8ff8eb21690345aa5673c1936bf560fca.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Update version to 4.7.0.2

Signed-off-by: Austin Seipp <austin@well-typed.com>
Update changelog.md
Fix base component of #9817 (ghc-7.8 7be1eb7)

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix typo

Signed-off-by: Austin Seipp <austin@well-typed.com>
Merge remote-tracking branch 'ghchq/ghc-7.8' into halvm