--- Stephan Zaubzer wrote:
data Entry a  = EmptyEntry | MakeEntry a a

showEntry :: (Show a) => Entry a -> String
showEntry EmptyEntry = "Empty"
showEntry MakeEntry a b = show a ++ ": " ++ show b
--- end of quote ---

That's a good start.  All you need to do now is make Entry an instance of the Show 
class:

> instance (Show a) => Show (Entry a)
>    where show = showEntry

Also, you have a small syntax error in showEntry - you probably want:

> showEntry (MakeEntry a b) = show a ++ ": " ++ show b

Finally, using ShowS is generally better for this kind of thing.  
<http://www.haskell.org/tutorial/stdclasses.html> describes the disadvantages of using 
repeated appends and the advantages of ShowS.  Hope that helps!  /gXm
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to