Skip to content

Commit

Permalink
Merge pull request #1598 from gallais/show-void
Browse files Browse the repository at this point in the history
[ fix ] missing Show implementations in libs
  • Loading branch information
edwinb authored Jun 23, 2021
2 parents 0a0c41d + afd5595 commit 5689786
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/base/Data/Fin.idr
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ finToNat : Fin n -> Nat
finToNat FZ = Z
finToNat (FS k) = S $ finToNat k


export
Show (Fin n) where
show = show . finToNat

||| `finToNat` is injective
export
finToNatInjective : (fm : Fin k) -> (fn : Fin k) -> (finToNat fm) = (finToNat fn) -> fm = fn
Expand Down
4 changes: 4 additions & 0 deletions libs/prelude/Prelude/Show.idr
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ Show Bool where
show True = "True"
show False = "False"

export
Show Void where
show v impossible

export
Show () where
show () = "()"
Expand Down
1 change: 1 addition & 0 deletions tests/idris2/docs001/expected
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Main> Prelude.Show : Type -> Type
Show String
Show Nat
Show Bool
Show Void
Show ()
(Show a, Show b) => Show (a, b)
(Show a, Show (p y)) => Show (DPair a p)
Expand Down

0 comments on commit 5689786

Please sign in to comment.