
Hello, I try to selfstudy haskell by following the yet another haskell tutorial. Now I have the exercise where I have a string and have to convert it into a list of Booleans based on lower cats letter using map. So i tried this x = "aBCde".islower:[] But I see this error : Not in Scope: 'isLower'. Where do I make my error. Do not give the answer otherwise I do not learn anything from it. Roelof --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com

isLower is not in the Prelude (the automatically imported module built-in
functions). Here's the list of all functions in Prelude:
http://hackage.haskell.org/package/base/docs/Prelude.html
isLower is in another module. You can figure that out by searching for
"isLower" on Hoogle:
http://www.haskell.org/hoogle/
You can even find it by searching for it by type, which is useful if you
don't remember the precise name. Try searching for "Char -> Bool".
In other words, you'll need to import isLower from somewhere before you can
use it.
On Sun, Mar 2, 2014 at 10:45 AM, Roelof Wobben
Hello,
I try to selfstudy haskell by following the yet another haskell tutorial.
Now I have the exercise where I have a string and have to convert it into a list of Booleans based on lower cats letter using map.
So i tried this
x = "aBCde".islower:[]
But I see this error : Not in Scope: 'isLower'.
Where do I make my error.
Do not give the answer otherwise I do not learn anything from it.
Roelof
--- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Packages and modules are not the same thing. Packages contain one or more
modules, they're typically just units of installation and not so much
something you deal with in the code.
If the tutorial hasn't talked about importing modules, then it's wrong.
Perhaps it's simply ancient and is written for some historical version of
Haskell that had these in Prelude? isLower is not part of Prelude, so you
must import it from somewhere. The IDE you're using is irrelevant.
On Sun, Mar 2, 2014 at 11:10 AM, Roelof Wobben
Thanks,
isLower is in base package. The tutorial has not spoken about importing modules.
I use the IDE of fpcomplete.
Roelof
Bob Ippolito schreef op 2-3-2014 20:02:
isLower is not in the Prelude (the automatically imported module built-in functions). Here's the list of all functions in Prelude: http://hackage.haskell.org/package/base/docs/Prelude.html
isLower is in another module. You can figure that out by searching for "isLower" on Hoogle: http://www.haskell.org/hoogle/
You can even find it by searching for it by type, which is useful if you don't remember the precise name. Try searching for "Char -> Bool".
In other words, you'll need to import isLower from somewhere before you can use it.
On Sun, Mar 2, 2014 at 10:45 AM, Roelof Wobben
wrote: Hello,
I try to selfstudy haskell by following the yet another haskell tutorial.
Now I have the exercise where I have a string and have to convert it into a list of Booleans based on lower cats letter using map.
So i tried this
x = "aBCde".islower:[]
But I see this error : Not in Scope: 'isLower'.
Where do I make my error.
Do not give the answer otherwise I do not learn anything from it.
Roelof
--- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
------------------------------ http://www.avast.com/
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirushttp://www.avast.com/actief is.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

isLower takes a character. You need to look at operating on the string
with higher order functions which will call isLower on each character.
On Mar 2, 2014 2:25 PM, "Roelof Wobben"
Found this one:
This is partly working:
import Data.Char
x = "aBCde".isLower -- Note that comments are preceded by two hyphens {- or enclosed in curly brace/hypens pairs. -} main = print x
But now I see this error:
- Main.hs@3:5-3:12 Couldn't match expected type `b0 -> c0' with actual type `[Char]' In the first argument of `(.)', namely `"aBCde"' In the expression: "aBCde" . isLower In an equation for `x': x = "aBCde" . isLower - In an equation for `x': x = "aBCde" . isLower
Roelof
Roelof Wobben schreef op 2-3-2014 20:10:
Thanks,
isLower is in base package. The tutorial has not spoken about importing modules.
I use the IDE of fpcomplete.
Roelof
Bob Ippolito schreef op 2-3-2014 20:02:
isLower is not in the Prelude (the automatically imported module built-in functions). Here's the list of all functions in Prelude: http://hackage.haskell.org/package/base/docs/Prelude.html
isLower is in another module. You can figure that out by searching for "isLower" on Hoogle: http://www.haskell.org/hoogle/
You can even find it by searching for it by type, which is useful if you don't remember the precise name. Try searching for "Char -> Bool".
In other words, you'll need to import isLower from somewhere before you can use it.
On Sun, Mar 2, 2014 at 10:45 AM, Roelof Wobben
wrote: Hello,
I try to selfstudy haskell by following the yet another haskell tutorial.
Now I have the exercise where I have a string and have to convert it into a list of Booleans based on lower cats letter using map.
So i tried this
x = "aBCde".islower:[]
But I see this error : Not in Scope: 'isLower'.
Where do I make my error.
Do not give the answer otherwise I do not learn anything from it.
Roelof
--- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
------------------------------ http://www.avast.com/
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirushttp://www.avast.com/actief is.
_______________________________________________ Beginners mailing listBeginners@haskell.orghttp://www.haskell.org/mailman/listinfo/beginners
------------------------------ http://www.avast.com/
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirushttp://www.avast.com/actief is.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Hi, W dniu 02.03.2014 21:06, Roelof Wobben pisze:
Thanks.
This does the job :
import Data.Char
x = map isLower "ABCde":[] -- Note that comments are preceded by two hyphens {- or enclosed in curly brace/hypens pairs. -} main = print x
You have a list of lists of booleans: [[Bool]]. You should get a list of booleans: [Bool] instead. Regards, Emanuel

Hello,
2014-03-02 20:50 GMT+01:00 Roelof Wobben
Correect, I forget to use map But also x = map "aBCde".islower does not work.
Your use of the dot (.) function makes me think you might mix Haskell syntax with OO languages like Python or Java where dot notation is used to call methods on objects.
Also, as Emanuel and Vlatko pointed out one very important thing in Haskell is reading type signatures. So, let's check `map` signature: map :: (a -> b) -> [a] -> [b] What does this mean? Although all Haskell functions take one and only one argument we probably might find it simpler to reason in terms of first argument, second argument and return value (`map` should probably be better described as a function that takes a function from `a` to `b` and returns a function from [a] to [b]). Anyway. The first argument is (a -> b), a function from `a` to `b`. The second argument is [a], i.e. a list of `a` (`a` can potentially represent any type). The last type in the signature is [b] which we might call the return type. Again, haskellers, don't stab me please :) Now check the type signature for `isLower`: isLower :: Char -> Bool `isLower` will be `map`'s first argument, so, replacing the original (a -> b) with isLower type signature, you'll get: map :: (Char -> Bool) -> [Char] -> [Bool] A step further, the signature then becomes: map isLower :: [Char] -> [Bool] As you can see here, understanding that all functions in Haskell takes just one argument helps because `map isLower` is in turn a function. The result of calling `map` with `isLower` as its (first and only) argument, is a function from [a], or, better, from [Char], since Char is the (first and only) argument of `isLower`, to [b], or, better, to [Bool] since Bool is the return type of `isLower`. Now we have map isLower which takes a [Char]. [Char] and String are synonyms, by the way, so you could also write `map isLower` signature as follows: map isLower :: String -> [Bool] This seems exactly what we need: a function from String to a list of booleans. I think I have to find out how I can ghci in fpcomplete or use another IDE
which supports it.
Roelof
Have you read/are you reading "Learn you a Haskell" ( http://learnyouahaskell.com/chapters)? I'd advise you to read it, as it helps you, in the beginning, being more confortable with Haskell's syntax and library. -- Nadir

Hi, W dniu 02.03.2014 20:24, Roelof Wobben pisze:
Found this one:
This is partly working:
import Data.Char
x = "aBCde".isLower -- Note that comments are preceded by two hyphens {- or enclosed in curly brace/hypens pairs. -} main = print x
But now I see this error:
* Main.hs@3:5-3:12 Couldn't match expected type `b0 -> c0' with actual type `[Char]' In the first argument of `(.)', namely `"aBCde"' In the expression: "aBCde" . isLower In an equation for `x': x = "aBCde" . isLower * In an equation for `x': x = "aBCde" . isLower
Roelof
This expression is wrong: "aBCde".isLower You call (.) function with 2 arguments: "aBCde" and isLower. This doesn't make sense for the compiler (type checker). Regards, Emanuel
participants (6)
-
Bob Ippolito
-
Emanuel Koczwara
-
Nadir Sampaoli
-
Roelof Wobben
-
Ryan Stradling
-
Vlatko Basic