Re: Haskell-Cafe digest, Vol 1 #342 - 1 msg

5 Mar
2002
5 Mar
'02
5:44 p.m.
I want to read a file's content into a string. content :: FilePath -> String content f = readFile f But when there is a type error: Type error in explicitly typed binding *** Term : content *** Type : FilePath -> IO String *** Does not match : FilePath -> String How can I solve it? Thanks. Zhe

6 Mar
6 Mar
2:48 a.m.
New subject: Haskell-Cafe digest, Vol 1 #342 - 1 msg
"Zhe Fu"
But when there is a type error: [...] How can I solve it?
I often remove the type declaration, load the code in GHCi or Hugs, and do a :t my_function. The interpreter then tells me what /it/ thinks is the type, and quite often it is smarter than I am :-) (You can also use :i, which is somewhat more informative) -kzm -- If I haven't seen further, it is by standing in the footprints of giants
8477
Age (days ago)
8478
Last active (days ago)
1 comments
2 participants
participants (2)
-
ketil@ii.uib.no
-
Zhe Fu