tldr: nub is abnormally slow, we shouldn't use it, but we do.
As you might know, Data.List.nub is O(n²). (*)
As you might not know, almost *all* practical Haskell projects use it,
and that in places where an Ord instance is given, e.g. happy, Xmonad,
ghc-mod, Agda, darcs, QuickCheck, yesod, shak
Similarly, I've always used:
import qualified Data.HashSet as S
nub :: Hashable a => [a] -> [a]
nub = S.toList . S.fromList
And i can't think of any type which i can't write a Hashable instance, so
this is extremely practical.
On Jul 14, 2013 7:24 AM, "Niklas Hambüchen" wrote:
> tldr: nub is a
Oops sorry I guess my point wasn't clear.
Why ord based when hashable is faster? Then there's no reason this has to
be in base, it can just be a free function in Data.HashSet. If stability is
a concern then there's a way to easily account for that using HashMap.
- Clark
On Jul 14, 2013 7:48 AM,
One of my main points is:
Should we not add such a function (ord-based, same output as nub,
stable, no sorting) to base?
As the package counting shows, if we don't offer an alternative, people
obviously use it, and not to our benefit.
(Not to say it this way:
We could make the Haskell world fa
Forgot to mention — a good explanation of GHC Generics is the paper
"A Generic Deriving Mechanism for Haskell".
Roman
* Roman Cheplyaka [2013-07-14 18:21:58+0300]
> Hi,
>
> (Redirecting this back to cafe to keep it discoverable — hope you don't
> mind.)
>
> * JP Moresmau [2013-07-14 16:02:56+
Something like that should definitely be included in Data.List.
Thanks for working on it.
Roman
* Niklas Hambüchen [2013-07-14 19:20:52+0800]
> tldr: nub is abnormally slow, we shouldn't use it, but we do.
>
>
> As you might know, Data.List.nub is O(n²). (*)
>
> As you might not know, almost
Hi,
(Redirecting this back to cafe to keep it discoverable — hope you don't
mind.)
* JP Moresmau [2013-07-14 16:02:56+0200]
> Hello, sorry to bother you after you've been kind enough to answer me on
> the list! I've looked a the smallcheck code but I don't see how to apply it
> to my issue. Firs
At Sun, 14 Jul 2013 07:31:05 -0400,
Clark Gaebel wrote:
> Similarly, I've always used:
>
> import qualified Data.HashSet as S
>
> nub :: Hashable a => [a] -> [a]
> nub = S.toList . S.fromList
>
> And i can't think of any type which i can't write a Hashable instance, so
> this is extremely practi
On Thu, Jul 11, 2013 at 03:39:02PM -0700, KC wrote:
> I ask this on this mailing list because there are quite a few
> mathematically oriented people here.
If you accept the Law of Excluded Middle, everything either has a
matroid structure, or not. On the other hand, if you do not accept
it, then
On Sun, Jul 14, 2013 at 7:31 AM, Clark Gaebel wrote:
> Similarly, I've always used:
>
> import qualified Data.HashSet as S
>
> nub :: Hashable a => [a] -> [a]
> nub = S.toList . S.fromList
>
> And i can't think of any type which i can't write a Hashable instance, so
> this is extremely practical.
On 12/07/2013, at 6:12 PM, Andreas Abel wrote:
[I can't try your F# example but ocaml does something different.]
Yes. They are different languages.
By the way, I used the F# that comes with Mono.
> On 12.07.2013 02:22, Richard A. O'Keefe wrote:
>> For what it's worth,
>>
>>> let x = 1 in
>> -
On 15 July 2013 09:54, Joey Adams wrote:
> On Sun, Jul 14, 2013 at 7:31 AM, Clark Gaebel wrote:
>>
>> Similarly, I've always used:
>>
>> import qualified Data.HashSet as S
>>
>> nub :: Hashable a => [a] -> [a]
>> nub = S.toList . S.fromList
>>
>> And i can't think of any type which i can't write
On 13/07/2013, at 11:27 PM, J. Stutterheim wrote:
>> - they then abandoned the Macintosh world for
>> Windows. The Mac IDE was killed off; there is
>> now an IDE for Windows but not MacOS or Linux.
>
> The good news is that the latest version of Clean[2] and its code
> generator[3] now works
Just so people are aware - five years ago the notion of nubOrd and
nubWith was discussed and a consensus reached on including nubOrd. I
think Bart got too busy, didn't submit a final patch, and no one with
commit access actually commited any code.
http://haskell.1045720.n5.nabble.com/GHC-2717-Add
14 matches
Mail list logo