A Shape must be a Circle or a Square. In Scala, I can write

def findCircles(shapes: List[Shape]): List[Circle]

In Haskell (and other FP languages), I'm stuck with:

findCircles :: [Shape] -> [Shape]

Is there a way to achieve the expressivity of the former if you lack subtypes?

Comments