lean4-htt/tests/lean/run/dotNotationAndDefaultInstance.lean
Leonardo de Moura 627594b88a fix: "dot"-notation should apply default instances before failing
See new test for motivating example.
2022-07-05 14:27:55 -07:00

18 lines
377 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace Ex
class Get (Cont : Type u) (Idx : Type v) (Elem : outParam (Type w)) where
get (xs : Cont) (i : Idx) : Elem
export Get (get)
instance [Inhabited α] : Get (Array α) Nat α where
get xs i := xs.get! i
example (as : Array (Nat × Bool)) : Bool :=
(get as 0).2
example (as : Array (Nat × Bool)) : Bool :=
let r1 (as : _) := (get as 0).2
r1 as
end Ex