Steve Frampton wrote:

Steve --

Try this:

 foo :: Int -> [Char]

leaving the rest as it is.  On my copy of Hugs, (Hugs98 on Linux running with
the -98 option), it works fine.

Good luck!

-- Seth

> Hello:
>
> Okay, I'm [damn] confused regarding type-casting in Haskell.  I'm trying
> to write a function that accepts an integer and then returns a set (in
> this case, a set of characters).
>
> I'm having a lot of problems with "Declared type too general", "Type error
> in application", etc. depending on what I try.
>
> My function looks sort of like this:
>
>   foo :: Int -> [a]
>   foo 0 = []
>   foo x = ['1'] ++ foo(x - 1)
>
> I would expect that I'd end up with a set of '1111's depending on how
> large a value I pass to 'foo'.  However, I can't seem to make the
> interpreter happy, no matter what I try (sounds like an ex-gf of mine).
>
> I thought maybe I need some kind of type-cast ala C, but I'm not really
> sure what needs to be put there.
>
> Any advice would be greatly appreciated.
>
> Thanks...
>
> --------------< LINUX: The choice of a GNU generation. >--------------
> Steve Frampton  <[EMAIL PROTECTED]>  http://qlink.queensu.ca/~3srf

=========================
Dr. Seth A. Greenblatt
President & CEO
Objective Science, Inc.
[EMAIL PROTECTED]




Reply via email to