Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can you declare a type constructor locally in SML?

4 views
Skip to first unread message

synth...@uol.com.br

unread,
Jan 6, 2005, 4:53:44 PM1/6/05
to
Hi all--

I can't seen to set a type locally. Is it wrong syntax? I would like
to set a flag (but I haven't got around to imperative-style in SML
yet).

type time = { hr: int, min: int, mer: string };

fun compare_mer(time_a: time, time_b: time) =
let val mer_a = #mer time_a
val mer_b = #mer time_b
type flag = { flag_num: int }
in
if mer_a = "AM" then let val flag1 = { flag_num = 1 } else let val
flag1 = { flag_num = 2 }
if mer_b = "AM" then let val flag2 = { flag_num = 1 } else let val
flag2 = { flag_num = 2 }
end;


TIA,

Cheers

Henry


0 new messages