Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell - importing functions from prelude

I have kind of a newbie question. I want to use some functions from prelude, but I'm getting same error all the time.

For example:

Undefined variable "diff"

Some other functions are working, some not. I guess I have to import something, Google didn't help me... I'm using WinHugs.

like image 352
prper Avatar asked Dec 06 '25 04:12

prper


2 Answers

Here are two sites you should bookmark, because they'll help you find functions you need -- and find out what you need to import.

http://haskell.org/hoogle/ http://holumbus.fh-wedel.de/hayoo/hayoo.html

Searching both those sites, I don't see anything that looks like the function you want. Some possibilities that occur to me are:

  • You're learning from a book that has examples of things you'd type at the Linux command line. "diff" is a common Linux command for comparing two files. I believe the windows equivalent is comp.

  • You're using some sample code that you got somewhere, but you didn't import everything you needed. If you can find the file that contains the "diff" function, import that.

  • You've written a function called "diff", and put it in another file. In the file where you want to use "diff", you need to import the module that contains it.

like image 123
mhwombat Avatar answered Dec 08 '25 23:12

mhwombat


Prelude is typically imported implicitly. Are you sure that is really your problem? Undefined variable "diff" is a bit vague, since I don't know of a diff function imported with Prelude. Can you elaborate?

like image 23
Elliot Cameron Avatar answered Dec 08 '25 23:12

Elliot Cameron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!