
5 Mar
2012
5 Mar
'12
4:04 p.m.
Is there any way in Haskell to have the correct function selected based on the types of two different types? For example, let's say I'm writing intersection tests: aABBandAABB :: AABB -> AABB -> Bool oBBandOBB :: OBB -> OBB -> Bool oBBandPoint :: OBB -> Point -> Bool Is there some way (such as with Type Families) that I can write some sort of generic method for this: intersects :: Intersectable -> Intersectable -> Bool which automatically selects the right function to call based on the types of the two intersectables? Regards, - clark