Open treeowl opened 9 years ago
This is almost certainly a failure to solve an implicit argument in some nested context. It's an atrocious error message.
Turning on logging yields this monstrosity:
Monoid v => (t : FingerTree v a ma) -> measureTree (mapTreePreserve f mb r t) = measureTree t
Elaborated: pat {a522} : Type 0. (v : Type 0) -> (a : Type 0) -> (ma : a -> v) -> (f : a -> {a522}) -> (mb : {a522} -> v) -> (r : = v v (mb (f {imp0})) (ma {imp0})) -> ({constrarg0} : Prelude.Algebra.Monoid v) -> (t : CopumpkinStyleFingerTrees.FingerTree v a ma) -> = v v (CopumpkinStyleFingerTrees.measureTree v {a522} mb {constrarg0} (CopumpkinStyleFingerTrees.mapTreePreserve v a {a522} ma {constrarg0} f mb (\ {imp0} : a => r) t)) (CopumpkinStyleFingerTrees.measureTree v a ma {constrarg0} t)
Glagh! I don't get why it's pattern-binding {a522}
.
The real error here is that it can't infer the type of 'r' in lm. The "imp" is the name of an implicit lambda - I am going to change this so that it at least gets the name from the implicit argument - but that imp ends up in the type of 'r' which can't be put in a sensible place in the type, hence the "No such variable" error.
There does seem to be an error in lm
which you can find out by making more of its types explicit, but I can probably find a way for it to say "Couldn't infer a type for r" or some such instead of the unhelpful No Such Variable error.
Yes, I strongly suspect the previous "less-than-helpful error message" tag was actually the right thing to have on this. A certain amount of abstraction leakage may be inherent in a language with implicits, but there are some boundaries that shouldn't be crossed. No, I don't know how to define such, nor how to allow for improved error messages at the boundaries. As @edwinb has stated, implicits seem to be a rather dark art.
Well, it's true, there is no such variable that I know of.