lean4-htt/tests/lean/run/hmulDefaultIntance.lean
Leonardo de Moura eabbb6eca0 feat: improve [defaultInstance]
cc @Kha
2020-11-25 18:33:06 -08:00

17 lines
319 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.

class HMul (α β : Type _) (γ : outParam (Type _)) where
hmul : α → β → γ
@[defaultInstance]
instance [Mul α] : HMul α α α where
hmul a b := a * b
infix:70 "*'" => HMul.hmul
instance : HMul Nat Bool Nat where
hmul
| x, true => x
| x, false => 0
#check 10 *' true
#check fun x => x *' 1