Version française
Home     About     Download     Resources     Contact us    
Browse thread
pm variant type question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeremy Yallop <jeremy.yallop@e...>
Subject: Re: [Caml-list] pm variant type question
skaller wrote:
> type 'a regexp_t' =
>   [
>   | `REGEXP_seq of 'a regexp_t' * 'a regexp_t' (** concatenation *)
>   | `REGEXP_alt of 'a regexp_t' * 'a regexp_t' (** alternation *)
>   | `REGEXP_aster of 'a regexp_t'  (** Kleene closure *)
>   | `REGEXP_string of string   (** concatenation of chars of string *)
>   | `REGEXP_epsilon            (** epsilon: null string *)
>   ]

If I understand rightly, then this should be

   type 'a regexp_t' =
     [
     | `REGEXP_seq of 'a * 'a (** concatenation *)
     | `REGEXP_alt of 'a * 'a (** alternation *)
     | `REGEXP_aster of 'a  (** Kleene closure *)
     | `REGEXP_string of string   (** concatenation of chars of string *)
     | `REGEXP_epsilon            (** epsilon: null string *)
     ]

The version you gave will result in an xreg_t type that doesn't allow 
things like

    `REGEXP_alt (`REGEXP_code x, `REGEXP_code x)

(In fact, in your version, the 'a parameter is never actually used.)

Jeremy.