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"
Hugs can't find your version of "my_map" because it is sitting in the "Char" module (notice the Char> prompt vs. Test>). You could fully qualify the function name (Test.my_map toUpper "Hello"), or you might want to add "import Char" to your source file. Something like... $ cat test.hs module Test where import Char my_map p [] = [] my_map p (x:xs) = p x : my_map p xs $ hugs __ __ __ __ ____ ___ || || || || || || ||__ Hugs 98: Based on the Haskell 98 ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2003 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Report bugs to: hugs-bugs@haskell.org || || Version: November 2003 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Prelude> :l test.hs Test> my_map toUpper "Hello" "HELLO" Test> _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe