base: Override Foldable.{toList,length} for NonEmpty
authorArtyom <yom@artyom.me>
Fri, 23 Dec 2016 19:36:55 +0000 (14:36 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 23 Dec 2016 21:44:48 +0000 (16:44 -0500)
commit94d2cce6742235d36efb71cf704acd1327a68481
tree75492511b8822c09a4a33fdb99b8449d6d1a3680
parent1b06231ea9063d753a2755a7fc4aeadcc2fc58b9
base: Override Foldable.{toList,length} for NonEmpty

Previously the Foldable instance for NonEmpty used default
implementations for toList and length.

I assume that the existing implementations
(i.e. Data.List.NonEmpty.{toList,length}) are better than
the default ones, and frankly can't see a good reason why they
might be worse – but if they are, instead of this commit
we'd have to switch Data.List.NonEmpty.{toList,length}
to use Foldable.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: int-index, thomie

Differential Revision: https://phabricator.haskell.org/D2882
libraries/base/Data/List/NonEmpty.hs