I am using VSCode as my IDE for Haskell on a Mac.
This simple function
toLowerSt :: String -> String
toLowerSt = map toLower
returns the following error:
Main.hs:92:17: error:
• Variable not in scope: toLower :: Char -> Char
• Perhaps you meant ‘toLowerSt’ (line 92)
|
92 | toLowerSt = map toLower
| ^^^^^^^
Failed, no modules loaded.
I struggle to understand what the actual problem here is. A string is mapped into chars yet it's throwing me this error.
CodePudding user response:
The toLower :: Char -> Char
function is defined in the Data.Char
module and not re-exported by the Prelude
, you thus need to import this with:
import Data.Char(toLower)
toLowerSt :: String -> String
toLowerSt = map toLower