[Haskell-cafe] please help... small problem

Radosław Grzanka radoslawg at gmail.com
Fri Nov 9 16:52:01 EST 2007

2007/11/9, Ryan Bloor <ryanbloor at hotmail.com>:
> hi
>  Is there anyway to cut down this code and to not use auxillary functons,
> but instead use pattern matching?
> The code basically splits up a list 'rslis' into a list of lists - but so
> each word is split up and the integers have been parsed. so.... ["hi ryan
> 1","hi jeff 2"] becomes [["hi","ryan" 1], ["hi","jeff", 2]].
> The code is far too long. I don't wanna use premade functions too much...
> pattern matching is required.

Can you show me the code of this - even if long and ugly? The output
is illegal AFAIK. (although I'm not haskell expert).

Prelude> :t [["hi","ryan", 1], ["hi","jeff", 2]]

    No instance for (Num [Char])
      arising from the literal `1' at <interactive>:1:15
    Possible fix: add an instance declaration for (Num [Char])
    In the expression: 1
    In the expression: ["hi", "ryan", 1]


Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/

More information about the Haskell-Cafe mailing list