Zulip Chat Archive
Stream: new members
Topic: confusing error message on functor
Alok Singh (Feb 22 2025 at 23:57):
instance : Functor (Vector · n) where
map f v := v.map f
/-
Expected type
⊢ ?m.96173 ?m.96191
typeclass instance problem is stuck, it is often due to metavariables
Functor ?m.96173
-/
#eval Functor.map id #v[1, 2, 3]
#eval #v[1, 2, 3].map id -- works
Why does the second form work when it's supposed to just be .map
? Shouldn't it infer the output type?
Aaron Liu (Feb 23 2025 at 00:40):
The second one uses Vector.map
, while the first one uses Functor.map
, which generates a second-order unification problem that can't be solved.
Last updated: May 02 2025 at 03:31 UTC