comparison src/elab_util.sml @ 198:ab86aa858e6c

'Option' datatype encoding
author Adam Chlipala <adamc@hcoop.net>
date Sat, 09 Aug 2008 19:23:31 -0400
parents aa54250f58ac
children dd82457fda82
comparison
equal deleted inserted replaced
197:b1b9bcfd8c42 198:ab86aa858e6c
28 structure ElabUtil :> ELAB_UTIL = struct 28 structure ElabUtil :> ELAB_UTIL = struct
29 29
30 open Elab 30 open Elab
31 31
32 fun classifyDatatype xncs = 32 fun classifyDatatype xncs =
33 if List.all (fn (_, _, NONE) => true | _ => false) xncs then 33 case xncs of
34 Enum 34 [(_, _, NONE), (_, _, SOME _)] => Option
35 else 35 | [(_, _, SOME _), (_, _, NONE)] => Option
36 Default 36 | _ =>
37 if List.all (fn (_, _, NONE) => true | _ => false) xncs then
38 Enum
39 else
40 Default
37 41
38 structure S = Search 42 structure S = Search
39 43
40 structure Kind = struct 44 structure Kind = struct
41 45