
On 2008 May 4, at 23:40, Ross Boylan wrote:
ERROR "grammar.hsl":21 - Type error in explicitly typed binding *** Term : envEnd *** Type : String -> GenParser Char a [Char] *** Does not match : String -> Parser ()
Hugs is prone to error messages that obscure the problem. The trick here is to realize that the type "Parser ()" is the same as "GenParser Char a ()"; this then tells you that you have used a function that returns a [Char] (aka String) where a type () (Haskell's version of (void)) is expected.
envEnd :: String -> Parser () envEnd name = do{ reserved "\\end" ; braces (string name) }
Line 21 is "; braces (string name)"; it is producing a String, when you need a (). One fix is to add one more line:
envEnd :: String -> Parser () envEnd name = do reserved "\\end" braces (string name) return ()
Another possible fix is to change the type of "envEnd" to "String -> Parser String"; this may depend on how it's used. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH