[Haskell-cafe] Haskell Questions

Daniel Fischer daniel.is.fischer at web.de
Thu Apr 21 09:30:54 EDT 2005

Am Donnerstag, 21. April 2005 12:37 schrieb Mike Richards:
> Hi,
> I'm working on a version of Simon Thompson's code from "The Craft of
> Functional
> programming" to handle polymorhpic data types.
> Heres the question Im working on - Ive tried doing the first part, but i
> would
> really apprecate it if someone could let me know if ive implemented it
> wrong.
> Mike

Could you be a little more precise on what you want to do?

Without knowing that, I can say that - so far at least - the only used import 
is Char (perhaps better import Data.Char?), maybe also the Prelude, that 
seems no longer to be automatically imported in the new hugs version. 
Then you could use 'nub' from Data.List instead of list2set, dig2Int is 
digitToInt from Data.Char and a few more.

matchPolyT doesn't work, it will return [] for any finite input, by the way, I 
couldn't figure out what 'Poly Type Type' is supposed to model.

The instance declaration Eq Type is broken (Poly is the culprit)
and in varParse you use 'spot' - why did you not adhere to Thompson's names in 
the first place? - and 'Var' which you didn't define.

If I understand your goal, I'd be happy to help.


More information about the Haskell-Cafe mailing list