
Try Prelude> :info (,) data (,) a b = (,) a b -- Defined in GHC.Tuple instance (Bounded a, Bounded b) => Bounded (a, b) -- Defined in GHC.Enum instance (Eq a, Eq b) => Eq (a, b) -- Defined in Data.Tuple instance (Ord a, Ord b) => Ord (a, b) -- Defined in Data.Tuple instance (Read a, Read b) => Read (a, b) -- Defined in GHC.Read instance (Show a, Show b) => Show (a, b) -- Defined in GHC.Show On Sat, Jul 11, 2009 at 12:25 PM, Patrick LeBoutillier < patrick.leboutillier@gmail.com> wrote:
On Sat, Jul 11, 2009 at 1:13 PM, Chaddaï Fouché
wrote: On Sat, Jul 11, 2009 at 5:57 PM, Patrick LeBoutillier
wrote: Does this make sense?
Yes, perfectly. I guess you just have to know about it... :)
Well, it's the lexicographic order, the most "natural", in any case the most used order for tuples, so it would be strange to have other expectations by default
Of course, the mechanism by which this work is interesting by itself.
Really interesting in fact. It shows how generic these concepts really are. But it wasn't obvious to me that a pair could be an instance of Ord.
This kind of gives you a clue:
Prelude> :info () data () = () -- Defined in GHC.Unit instance Bounded () -- Defined in GHC.Enum instance Enum () -- Defined in GHC.Enum instance Eq () -- Defined in Data.Tuple instance Ord () -- Defined in Data.Tuple instance Read () -- Defined in GHC.Read instance Show () -- Defined in GHC.Show
but is there a way to do the equivalent of:
Prelude> :info (a,b) or Prelude> :info (Int,String)
?
Patrick
-- Jedaï
-- ===================== Patrick LeBoutillier Rosemère, Québec, Canada _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners