1 (* Title: HOL/Library/Code_Char.thy
3 Author: Florian Haftmann
6 header {* Code generation of pretty characters (and strings) *}
12 declare char.recs [code func del] char.cases [code func del]
15 "size (c\<Colon>char) = 0"
19 "char_size (c\<Colon>char) = 0"
29 val charr = @{const_name Char}
30 val nibbles = [@{const_name Nibble0}, @{const_name Nibble1},
31 @{const_name Nibble2}, @{const_name Nibble3},
32 @{const_name Nibble4}, @{const_name Nibble5},
33 @{const_name Nibble6}, @{const_name Nibble7},
34 @{const_name Nibble8}, @{const_name Nibble9},
35 @{const_name NibbleA}, @{const_name NibbleB},
36 @{const_name NibbleC}, @{const_name NibbleD},
37 @{const_name NibbleE}, @{const_name NibbleF}];
39 fold (fn target => CodeTarget.add_pretty_char target charr nibbles)
40 ["SML", "OCaml", "Haskell"]
41 #> CodeTarget.add_pretty_list_string "Haskell"
42 @{const_name Nil} @{const_name Cons} charr nibbles
46 code_instance char :: eq
55 code_const "op = \<Colon> char \<Rightarrow> char \<Rightarrow> bool"
56 (SML "!((_ : char) = _)")
57 (OCaml "!((_ : char) = _)")
58 (Haskell infixl 4 "==")