I downloaded the most recent vesion of winHugs and I installed it.
I'm trying to follow a tutorial about the commands (hugs2List pg 3).
I try to use the Prelude function isDigit, but this gives an error.

-- File second.hs
getDigits :: [Char] -> [Char]
getDigits s = [C|c <-s, isDigit c]

Prelude> Undefined variable "isDigit"

I've noticed that in the tutorial Prelude> is named Main> Does it have something to do with the version/modules? How can I use this isDigit?

Thank you for your attention!

Recommended Answers

All 2 Replies

At the top of your main program (the .hsx file) you should have something like:

module MyProg where

import Char

In this example I named my .hsx file "MyProg.hsx" but you can name it whatever you like. Make sure to import every library you need. The isDigit function is in the Char module of the Prelude.

Hope this helps.

Thanks a lot! It works now!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.