Can anyone give me some examples of the methods spanM, filterM, breakM etc?
Obviously there's the classic "powerset" implementation:
List('a, 'b, 'c) filterM (s => List(true, false))
But I personally find this difficult to have any intuition about. For example, what is going to happen if I use:
scala> val f: Int => Option[Boolean] = i => if (i % 3 == 0) None else Some(i % 2 == 0)
f: Int => Option[Boolean] = <function1>
And then call:
scala> List(1, 2, 3, 4) filterM f
scala> List(1, 2, 4) breakM f
scala> List(1, 2, 4) partitionM f
scala> List(1, 2, 3, 4) takeUntilM f
scala> List(3, 4) takeUntilM f
Obviously I've tried this and it has provided a little ilumination but I'd love to hear a great use of any of these functions
Chris