[Haskell-cafe] Beginner problems with 'triple' code

Jon Fairbairn Jon.Fairbairn at cl.cam.ac.uk
Mon Jul 26 13:20:13 EDT 2004


On 2004-07-26 at 18:10BST =?iso-8859-1?q?Stu=20White?= wrote:
> Hi
>  
> I'm not especially experienced in using haskell, and I could use some help.
>  
> As part of a project, I'm trying to construct a data type
> that can represent three values as a 'triple' (as opposed
> to a 'tuple'),

you could just use triples: (a,b,c)

> and then make a function so that I can sort these values
> into ascending order.
>  
> I'm having a few problems with the code that I have at the minute (I suspect its riddled with errors!)
>  
> type Triple = Triple {

"type" is essentially for renaming types, you want "data" here.

>     entry 1 :: a;

You can't have spaces in field names. Make those changes and
see what hugs or ghci says to it.

> <DIV>Hi</DIV>

(and more html snipped) Please don't send html messages to the list!

  Jón

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list