Mercurial > urweb
diff 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 |
line wrap: on
line diff
--- a/src/elab_util.sml Sat Aug 09 16:54:04 2008 -0400 +++ b/src/elab_util.sml Sat Aug 09 19:23:31 2008 -0400 @@ -30,10 +30,14 @@ open Elab fun classifyDatatype xncs = - if List.all (fn (_, _, NONE) => true | _ => false) xncs then - Enum - else - Default + case xncs of + [(_, _, NONE), (_, _, SOME _)] => Option + | [(_, _, SOME _), (_, _, NONE)] => Option + | _ => + if List.all (fn (_, _, NONE) => true | _ => false) xncs then + Enum + else + Default structure S = Search