src/HOL/Library/Code_Char.thy
author haftmann
Fri Feb 20 10:14:31 2009 +0100 (2009-02-20)
changeset 30007 74d83bd18977
parent 28346 b8390cd56b8f
child 30663 0b6aff7451b2
permissions -rw-r--r--
dropped Id
     1 (*  Title:      HOL/Library/Code_Char.thy
     2     Author:     Florian Haftmann
     3 *)
     4 
     5 header {* Code generation of pretty characters (and strings) *}
     6 
     7 theory Code_Char
     8 imports Plain "~~/src/HOL/List" "~~/src/HOL/Code_Eval"
     9 begin
    10 
    11 code_type char
    12   (SML "char")
    13   (OCaml "char")
    14   (Haskell "Char")
    15 
    16 setup {*
    17   fold (fn target => add_literal_char target) ["SML", "OCaml", "Haskell"] 
    18   #> add_literal_list_string "Haskell"
    19 *}
    20 
    21 code_instance char :: eq
    22   (Haskell -)
    23 
    24 code_reserved SML
    25   char
    26 
    27 code_reserved OCaml
    28   char
    29 
    30 code_const "eq_class.eq \<Colon> char \<Rightarrow> char \<Rightarrow> bool"
    31   (SML "!((_ : char) = _)")
    32   (OCaml "!((_ : char) = _)")
    33   (Haskell infixl 4 "==")
    34 
    35 code_const "Code_Eval.term_of \<Colon> char \<Rightarrow> term"
    36   (SML "HOLogic.mk'_char/ (IntInf.fromInt/ (Char.ord/ _))")
    37 
    38 end