Type errors in Haskell programming languages - Plz help

Hi, I was trying this Haskell program and was getting the following type error. The code is as follows - <-- Code starts --> entry :: [Char] -> [(Char,Int)] entry list = do t <- getGroups list mergeGroups t getGroups :: [Char] -> [(Char,Int)] mergeGroups :: [(Char,Int)] -> [(Char,Int)] <-- Code Ends --> The function getGroups and mergeGroups compile perfectly fine. The error i am getting is in the function entry . To paste the message, " *** Expression : mergeGroups t *** Term : t *** Type : (Char,Int) *** Does not match : [(Char,Int)] " Thanks in advance for helping me in this regard. Cheers Karthik. __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree

Hello.
The code is as follows - <-- Code starts --> entry :: [Char] -> [(Char,Int)] entry list = do t <- getGroups list mergeGroups t
getGroups :: [Char] -> [(Char,Int)] mergeGroups :: [(Char,Int)] -> [(Char,Int)] <-- Code Ends -->
You probably mean: entry list = let t = getGroups list in mergeGroups t or simpler entry = mergeGroups . getGroups Take a look at the instance Monad [ ] in the Prelude to see, why your program does not work. Ciao, Steffen

Thanks Steffen. This one worked. Cheers Karthik. --- s_mazanek@gmx.de wrote:
Hello.
The code is as follows - <-- Code starts --> entry :: [Char] -> [(Char,Int)] entry list = do t <- getGroups list mergeGroups t
getGroups :: [Char] -> [(Char,Int)] mergeGroups :: [(Char,Int)] -> [(Char,Int)] <-- Code Ends -->
You probably mean:
entry list = let t = getGroups list in mergeGroups t
or simpler
entry = mergeGroups . getGroups
Take a look at the instance Monad [ ] in the Prelude to see, why your program does not work.
Ciao, Steffen
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
__________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree
participants (2)
-
Karthik Kumar
-
s_mazanek@gmx.de