Generalize "set" operations from Data.List

I've suffered from inconvenience due to the restricted type signature. I'll be very glad if such restrictions are lifted: deleteBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> a -> [b] -> [b] deleteFirstsBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [b] intersectBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [a] I approve these versions because: 1. It makes more sense that the "usual" `delete` and `intersect` functions are specialization of the "By" operations, not the vice versa. 2. Data.Map.Lazy module from *containers* package has these kind of "By" operations. The previous discussion about this in Sep 2016 didn't make much conclusion, so let the discussion continue.

I don't think it's really so great that Data.List has a bunch of operations
that are inefficient on lists.
On Wed, Oct 31, 2018, 10:53 PM Dannyu NDos I've suffered from inconvenience due to the restricted type signature.
I'll be very glad if such restrictions are lifted: deleteBy :: (a -> b -> Bool
http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool)
-> a -> [b] -> [b]
deleteFirstsBy :: (a -> b -> Bool
http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool)
-> [a] -> [b] -> [b]
intersectBy :: (a -> b -> Bool
http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool)
-> [a] -> [b] -> [a] I approve these versions because:
1. It makes more sense that the "usual" `delete` and `intersect` functions
are specialization of the "By" operations, not the vice versa.
2. Data.Map.Lazy module from *containers* package has these kind of "By"
operations. The previous discussion about this in Sep 2016 didn't make much
conclusion, so let the discussion continue.
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

It would be more ineffecient if I had to convert my lists to Data.Sets ot
Data.Maps every time... For small lists, the operations are simple and
practical. This doesn't have anything with generalization of type
signatures anyway.
2018년 11월 1일 (목) 11:58에 David Feuer
I don't think it's really so great that Data.List has a bunch of operations that are inefficient on lists.
On Wed, Oct 31, 2018, 10:53 PM Dannyu NDos
I've suffered from inconvenience due to the restricted type signature. I'll be very glad if such restrictions are lifted:
deleteBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> a -> [b] -> [b] deleteFirstsBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [b] intersectBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [a]
I approve these versions because: 1. It makes more sense that the "usual" `delete` and `intersect` functions are specialization of the "By" operations, not the vice versa. 2. Data.Map.Lazy module from *containers* package has these kind of "By" operations.
The previous discussion about this in Sep 2016 didn't make much conclusion, so let the discussion continue. _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

Isn't deleteBy achievable via a filter? On 10/31/18 10:03 PM, Dannyu NDos wrote:
It would be more ineffecient if I had to convert my lists to Data.Sets ot Data.Maps every time... For small lists, the operations are simple and practical. This doesn't have anything with generalization of type signatures anyway.
2018년 11월 1일 (목) 11:58에 David Feuer
mailto:david.feuer@gmail.com>님이 작성: I don't think it's really so great that Data.List has a bunch of operations that are inefficient on lists.
On Wed, Oct 31, 2018, 10:53 PM Dannyu NDos
mailto:ndospark320@gmail.com wrote: I've suffered from inconvenience due to the restricted type signature. I'll be very glad if such restrictions are lifted:
deleteBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> a -> [b] -> [b] deleteFirstsBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [b] intersectBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [a]
I approve these versions because: 1. It makes more sense that the "usual" `delete` and `intersect` functions are specialization of the "By" operations, not the vice versa. 2. Data.Map.Lazy module from *containers* package has these kind of "By" operations.
The previous discussion about this in Sep 2016 didn't make much conclusion, so let the discussion continue. _______________________________________________ Libraries mailing list Libraries@haskell.org mailto:Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

filter erases all elements not satisfying given predicate. deleteBy erases
only the first element satisfying given predicate.
2018년 11월 1일 (목) 12:17에 Vanessa McHale
Isn't deleteBy achievable via a filter? On 10/31/18 10:03 PM, Dannyu NDos wrote:
It would be more ineffecient if I had to convert my lists to Data.Sets ot Data.Maps every time... For small lists, the operations are simple and practical. This doesn't have anything with generalization of type signatures anyway.
2018년 11월 1일 (목) 11:58에 David Feuer
님이 작성: I don't think it's really so great that Data.List has a bunch of operations that are inefficient on lists.
On Wed, Oct 31, 2018, 10:53 PM Dannyu NDos
I've suffered from inconvenience due to the restricted type signature. I'll be very glad if such restrictions are lifted:
deleteBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> a -> [b] -> [b] deleteFirstsBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [b] intersectBy :: (a -> b -> Bool http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Bool.html#t:Bool) -> [a] -> [b] -> [a]
I approve these versions because: 1. It makes more sense that the "usual" `delete` and `intersect` functions are specialization of the "By" operations, not the vice versa. 2. Data.Map.Lazy module from *containers* package has these kind of "By" operations.
The previous discussion about this in Sep 2016 didn't make much conclusion, so let the discussion continue. _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing listLibraries@haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
participants (3)
-
Dannyu NDos
-
David Feuer
-
Vanessa McHale