Last active
December 18, 2015 00:09
-
-
Save WillNess/5694080 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Replying to [comment:3 simonpj]: -- http://hackage.haskell.org/trac/ghc/ticket/7913 | |
| `nubBy` and `nub` are both intuitively ''left'' scans. `nub` should behave like | |
| `concatMap fst . scanl (\(_,prevs) new-> if not (((elem new prevs))) then | |
| ([new],new:prevs) else ([],prevs)) ([],[])`. | |
| `nub` should be the same as `nubBy (==)`. | |
| Report is consistent in this regard, as it also defines `elem x = any (== x)`, | |
| as well as | |
| {{{ | |
| nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs) | |
| -- ^^^ older newer | |
| }}} | |
| Looks like it must be changed, although this will break existing code | |
| (e.g. {{{nubBy (((==0).).rem) [2..]}}} ). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment