lean4-htt/tests/lean/defaultInstanceWithPrio.lean
Leonardo de Moura c67541570f fix: fixes #787
2021-11-15 18:31:57 -08:00

13 lines
271 B
Text

structure Rational where
num : Int
den : Nat
inv : den ≠ 0
@[defaultInstance 200]
instance : OfNat Rational n where
ofNat := { num := n, den := 1, inv := by decide }
instance : ToString Rational where
toString r := s!"{r.num}/{r.den}"
#check 2 -- Rational