Redundancy in implicit parameter error messages

Alastair David Reid reid at cs.utah.edu
Thu Aug 16 21:05:37 EDT 2001


If you have a function with several implicit parameters, you get a
separate error message for every implicit parameter that is not
provided or available.  For example, I routinely see error messages
like the following which differ only in the 2nd line of each message
(the bit that says what could not be deduced) and the 4th and 6th lines
which suggest a fix.

It'd be easier to understand what I did wrong if I got just one error
message.  This is especially so because common changes like factoring
out a repeated piece of code into a single function tends to generate
implicit parameter errors and generates them in very place that calls
the function and in the definition itself - so there's a lot of error
messages to wade through.


../TcUnits.hs:170:
    Could not deduce `?fenv :: FlagsEnv' from the context ()
    Probable fix:
        Add `?fenv :: FlagsEnv'
        to the type signature(s) for {bundleIdents, bs', benvty, benvty2, glues', benvty1, benv, ty, imps', exps', oenv}
        Or add an instance declaration for `?fenv :: FlagsEnv'
    arising from use of `binding' at ../TcUnits.hs:170
    In the first argument of `concatMap', namely `binding'
    in the definition of function `bs'':
        concatMap binding bs with [(flatten, flatten), (benvty, benvty),
                                   (benv, benv)]

../TcUnits.hs:170:
    Could not deduce `?btenv :: BTEnv' from the context ()
    Probable fix:
        Add `?btenv :: BTEnv'
        to the type signature(s) for {bundleIdents, bs', benvty, benvty2, glues', benvty1, benv, ty, imps', exps', oenv}
        Or add an instance declaration for `?btenv :: BTEnv'
    arising from use of `binding' at ../TcUnits.hs:170
    In the first argument of `concatMap', namely `binding'
    in the definition of function `bs'':
        concatMap binding bs with [(flatten, flatten), (benvty, benvty),
                                   (benv, benv)]

../TcUnits.hs:170:
    Could not deduce `?uenv :: UnitEnv' from the context ()
    Probable fix:
        Add `?uenv :: UnitEnv'
        to the type signature(s) for {bundleIdents, bs', benvty, benvty2, glues', benvty1, benv, ty, imps', exps', oenv}
        Or add an instance declaration for `?uenv :: UnitEnv'
    arising from use of `binding' at ../TcUnits.hs:170
    In the first argument of `concatMap', namely `binding'
    in the definition of function `bs'':
        concatMap binding bs with [(flatten, flatten), (benvty, benvty),
                                   (benv, benv)]



-- 
Alastair Reid        reid at cs.utah.edu        http://www.cs.utah.edu/~reid/




More information about the Glasgow-haskell-bugs mailing list