[Haskell-beginners] Typing/N00b question/My first haskell.

bryan hunt sentimental.bryan at gmail.com
Mon Nov 21 11:38:03 CET 2011



I'm trying to read in a value and convert it into a number for use in the
ageJudge function. I've tried a number of different approaches but keep
getting type conversion errors. This is literally my first Haskel
program - so please don't laugh...

module Main where

ageJudge :: (Integral a) => a -> String
ageJudge age
    | age >= 40 = "You're too old!"
    | age <= 30 = "Your too young"
    | otherwise   = "Not in the programming age range.."

main = do
  putStrLn "What is your name?"
  name <- getLine
  putStrLn ("Nice to meet you, " ++ name ++ "!")
  putStrLn "What is your age?"
  age <- getLine
  let inpIntegral = (read age)::Double
--  let decission = ageJudge (read inpIntegral)::Integral
  putStrLn ("We decided!")
--  putStrLn ("We decided:\n" ++ show(1) ++ "!")
-- ageJudge inpIntegral 





More information about the Beginners mailing list