on master help sign in
Give Fin an Ord instance.
6f651b0Greg Pfeil
libs/prelude/Prelude/Fin.idr+6−1
@@ -92,7 +92,12 @@ last {n=S _} = fS last
92total fSinjective : {f : Fin n} -> {f' : Fin n} -> (fS f = fS f') -> f = f'
92total fSinjective : {f : Fin n} -> {f' : Fin n} -> (fS f = fS f') -> f = f'
93fSinjective refl = refl
93fSinjective refl = refl
94
94
95−
95+instance Ord (Fin n) where
96+ compare fZ fZ = EQ
97+ compare fZ (fS _) = LT
98+ compare (fS _) fZ = GT
99+ compare (fS x) (fS y) = compare x y
100+
96instance MinBound (Fin (S n)) where
101instance MinBound (Fin (S n)) where
97 minBound = fZ
102 minBound = fZ
98
103