Compilation issues using scalaz's MA methods on Set but not List
        Posted  
        
            by oxbow_lakes
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by oxbow_lakes
        
        
        
        Published on 2010-04-21T11:36:35Z
        Indexed on 
            2010/04/21
            21:43 UTC
        
        
        Read the original article
        Hit count: 402
        
The following compiles just fine using scala Beta1 and scalaz snapshot 5.0:
val p1: Int => Boolean = (i : Int) => i > 4
val s: List[Int] = List(1, 2, 3)
val b1 = s ? p1
And yet this does not:
val s: Set[Int] = Set(1, 2, 3)
val b1 = s ? p1
I get the following error:
Found: Int => Boolean
Required: Boolean => Boolean
The signature of the ? method is:
def ?(p: A => Boolean)(implicit r: FoldRight[M]): Boolean = any(p)
And there should be an implicit SetFoldRight in scope. It is exactly the same for the methods: ?, ? and ?: - what is going on? 
© Stack Overflow or respective owner