|
[ ghc-Bugs-1281598 ] GHC poor type-checker error message: msg#00012lang.haskell.glasgow.bugs
Bugs item #1281598, was opened at 2005-09-04 09:23 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1281598&group_id=8032 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compiler (Type checker) Group: 6.4 Status: Open Resolution: None Priority: 5 Submitted By: Isaac (isaacdupree) Assigned to: Nobody/Anonymous (nobody) Summary: GHC poor type-checker error message Initial Comment: Here is a very tricky GHC (6.4) error message I found. I have simplified the context from where I found it, but the error is basically the same (still rather less confusing than the real thing, where Value :: [TString], TString :: [(String,Textdomain)], and error messages talked about, e.g., [[([Char],Textdomain)]] instead of [[Char]]). I had to run the original through Hugs to find my mistake there. Here is the code: > import Data.List(intersperse) > type Value = String > -- unifyEnd :: [key] -> [Value] -> [Value] > -- this example assumes (length ks <= length vs) > unifyEnd ks vs = > let (fvs,evs) = splitAt (length ks - 1) vs > in fvs ++ concat (intersperse "," evs) Here is the GHC-6.4 error message: BadErrorMessage.lhs:10:41: Couldn't match `[Char]' against `Char' Expected type: [[Char]] Inferred type: [Char] In the second argument of `intersperse', namely `evs' In the first argument of `concat', namely `(intersperse "," evs)' The error message when the type signature is uncommented at least might lead to less pursuing of the wrong things, claiming the literal `","' is in error instead, but does not get to the location of the error. The Hugs error, while not perfect, has got the location correct: it shows me the part I erred in: ERROR "BadErrorMessage.lhs":8 - Type error in application *** Expression : fvs ++ concat (intersperse "," evs) *** Term : fvs *** Type : [[Char]] *** Does not match : [Char] I had forgotten to put [ ] around concat (...), i.e. fvs ++ [concat (intersperse "," evs)] is the corrected fragment of the definition. GHC did not appear to realize that the two arguments to 'intersperse' were currently consistent with each other, given intersperse's type signature of a -> [a] -> [a], but would not be if the type of the one claimed to be in error were changed to the "expected" type. (If it could say that they were both the wrong type, that would be another choice it had that makes sense, but that would be two human errors, perhaps less likely than one.) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1281598&group_id=8032
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ ghc-Bugs-1281130 ] "class A where a :: A -> Int" panics GHC 6.4, SourceForge.net |
|---|---|
| Next by Date: | [ ghc-Bugs-904234 ] .lhs Birdtracks are removed instead of replaced, SourceForge.net |
| Previous by Thread: | [ ghc-Bugs-1281130 ] "class A where a :: A -> Int" panics GHC 6.4, SourceForge.net |
| Next by Thread: | [ ghc-Bugs-904234 ] .lhs Birdtracks are removed instead of replaced, SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |