[Haskell-beginners] List.sort

Patrick LeBoutillier patrick.leboutillier at gmail.com
Sat Jul 11 14:25:34 EDT 2009


On Sat, Jul 11, 2009 at 1:13 PM, Chaddaï Fouché<chaddai.fouche at gmail.com> wrote:
> On Sat, Jul 11, 2009 at 5:57 PM, Patrick
> LeBoutillier<patrick.leboutillier at gmail.com> 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


More information about the Beginners mailing list