summaryrefslogtreecommitdiff
path: root/src/elf_model/show.lem
diff options
context:
space:
mode:
Diffstat (limited to 'src/elf_model/show.lem')
-rw-r--r--src/elf_model/show.lem14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/elf_model/show.lem b/src/elf_model/show.lem
index b9d45f08..95a3b648 100644
--- a/src/elf_model/show.lem
+++ b/src/elf_model/show.lem
@@ -4,6 +4,7 @@
open import Function
open import List
+open import Maybe
open import Num
open import String
@@ -44,7 +45,7 @@ end
*)
val string_of_list : forall 'a. Show 'a => list 'a -> string
let string_of_list l =
- let result = intercalate "," (map show l) in
+ let result = intercalate "," (List.map show l) in
let folded = foldr (^) "" result in
"[" ^ folded ^ "]"
@@ -52,6 +53,17 @@ instance forall 'a. Show 'a => (Show (list 'a))
let show = string_of_list
end
+val string_of_maybe : forall 'a. Show 'a => maybe 'a -> string
+let string_of_maybe m =
+ match m with
+ | Nothing -> "Nothing"
+ | Just e -> "Just " ^ show e
+ end
+
+instance forall 'a. Show 'a => (Show (maybe 'a))
+ let show = string_of_maybe
+end
+
instance (Show nat)
let show = string_of_nat
end