
27 Nov
2008
27 Nov
'08
2:51 a.m.
Paul Johnson wrote:
class (Eq a) => AppEq f a where
instance (Applicative f, Eq a) => AppEq f a where instance (Ord a) => AppEq Interval a where
In Haskell, instances are selected based solely on the types in the head. Constraints like `Applicative f' are not consulted when the instance is being selected. Rather, constraints are checked after the instance has been selected. The above two instances are overlapping since Interval is a particular case of `f'. That said, it is possible to select an instance based on constraints. The approach is described at http://haskell.org/haskellwiki/GHC/AdvancedOverlap
6019
Age (days ago)
6019
Last active (days ago)
0 comments
1 participants
participants (1)
-
oleg@okmij.org