kowainik / slist

♾️ Sized list
https://kowainik.github.io/projects/slist
Mozilla Public License 2.0
46 stars 6 forks source link

Add 'partitionOn' #34

Closed chshersh closed 3 years ago

chshersh commented 4 years ago

Currently, slist has the following function:

partition :: forall a. (a -> Bool) -> Slist a -> (Slist a, Slist a)

But sometimes it's desirable to change the types of lists, and the function like below can be helpful:

partitionOn :: (a -> Either b c) -> Slist a -> (Slist b, Slist c)

The name can be different :slightly_smiling_face: But I wanted something like this for ordinary lists so many times...