[Haskell-cafe] Writing functions in Haskell.
Hal Daume III
hdaume at ISI.EDU
Thu Apr 28 22:44:14 EDT 2005
Try:
module Test where
import Char
...
then you don't have to load it in Hugs. When you load it, I think (could
be wrong, I'm not a big hugs guy) it's clearing the fact that you loaded
Test.
On Thu, 28 Apr 2005, Daniel Carrera wrote:
> Alright, I have what I believe must be a simple question. As one of the
> exercises for the Haskell tutorial I got I have to implement an
> alternative to the 'map' function.
>
> This is what I have:
>
> -----------------------------
> my/prompt $ cat Test.hs
> module Test
> where
>
> my_map p [] = []
> my_map p (x:xs) = p x : my_map p xs
> my/prompt $ hugs
>
> [snip]
>
> Hugs.Base> :l Test
> Test> :also Char
> Char> map toUpper "Hello"
> "HELLO"
> Char> my_map toUpper "Hello"
> ERROR - Undefined variable "my_map"
> -----------------------------
>
> I can define other functions now (e.g. Fibonacci, length of a list). So
> I'm not sure why I'm doing wrong here. Even if my syntax is wrong in
> some way, the function should be defined.
>
> I would be grateful if anyone could point out my error.
>
> Cheers,
> Daniel.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Hal Daume III | hdaume at isi.edu
"Arrest this man, he talks in maths." | www.isi.edu/~hdaume
More information about the Haskell-Cafe
mailing list