
26 Mar
2008
26 Mar
'08
5:07 p.m.
On Wed, Mar 26, 2008 at 08:52:43PM +0000, Ganesh Sittampalam wrote:
I'm a bit confused about why the following program doesn't compile (in any of 6.6.1, 6.8.1 and 6.9.20080316). Shouldn't the Ord (a, b) context be reduced?
{-# LANGUAGE FlexibleContexts #-}
module Test2 where
foo :: Ord (a, b) => (a, b) -> (a, b) foo = bar
bar :: (Ord a, Ord b) => (a, b) -> (a, b) bar = id
To use bar, you need (Ord a, Ord b). You're assuming that Ord (a, b) implies that, but it's the other way round.