[Haskell] Re: Overloading show
s.zaubzer at gmx.at
Fri Sep 10 19:51:12 EDT 2004
Thank you to all 3 of you! That helped a lot!
> Stephan Zaubzer writes:
>> Here my attempts:
>> data Entry a = EmptyEntry | MakeEntry a a
>> showEntry :: (Show a) => Entry a -> String
>> showEntry EmptyEntry = "Empty"
>> showEntry MakeEntry a b = show a ++ ": " ++ show b
>> what am I doing wrong? I have seen this way on some tutorials.
> I believe that if you looked cautiously at the system response
> you would guess yourself.
> Parentheses missing, it should be
> showEntry (MakeEntry a b) = ...
> Jerzy Karczmarczuk
> ... who has a pleasure of correcting thousands students' programs
> per year, so this kind of error burns his eyes...
> Haskell mailing list
> Haskell at haskell.org
More information about the Haskell