views:

113

answers:

1

Hi, I'm having some difficulty integrating && within Guards eg:

something :: Char -> Int
something k 
 | ord k >= 77 && ord k <= 98 = 8
 | otherwise = 88

How the heck can i achieve the above without setting off an error?

Cheers.

+2  A: 

In Haskell, an identifier starting with an uppercase letter designates a type, whereas a function name has to start with a lowercase letter.

mmarx
4Flower
Press the "edit" button and fix the typo then.
Artelius
Apart from the uppercase `Something`, there's nothing wrong with that snippet. If you haven't already done so, you'll need to import `ord` from the `Char` module.
mmarx
Darn, it appearns my example is too simple to set off the error my actual code set's off...please give me a moment guys while i type in my actual code.
4Flower
An identifier starting with an Uppercase letter (`:` too) can also designate a data constructor.
ephemient