Am Sat, 26 May 2007 19:21:41 +0200
schrieb Thomas Heye < 1910-131%40onlinehome.de">1910-131
onlinehome.de>:
> Hi folks,
> if I define my own data types in OCaml... Can I impose additional
> restrictions within a type constructor? For example, to represent a
> "time value" with fields hour, min, sec, then the field values should
> lie within 0-23 (for hour), 0-59 (for min/sec).
>
> Best regards,
> Thomas
you can make the datatype private, so values of it can only be created
with your functions, but pattern matching works.
Michael
.