Version française
Home     About     Download     Resources     Contact us    
Browse thread
Issues with Sexplib (#2)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dario Teixeira <darioteixeira@y...>
Subject: Issues with Sexplib (#2)
Hi again,

The second issue is a bit more straightforward, though I reckon it may
actually be in Type-conv (used by Sexplib).  Consider the following code:

(* TYPE_CONV_PATH "Order" *)

module Order =
struct
    type ordinal_t = [ `Ordinal of int ] (* with sexp *)
    type hierarchical_t = [ `Hierarchical of int list ] (* with sexp *)
    type appendix_t = [ `Appendix of int list ] (* with sexp *)
    type 'a scheme_t = 'a constraint 'a = [< ordinal_t | hierarchical_t | appendix_t ] (* with sexp *)

    type 'a auto_t = [ `Auto of 'a scheme_t ] (* with sexp *)
    type 'a user_t = [ `User of 'a scheme_t ] (* with sexp *)
    type none_t = [ `None ] (* with sexp *)
    type ('a, 'b) given_t = 'b constraint 'b = [< 'a auto_t | 'a user_t | none_t ] (* with sexp *)

    type body_sectional_order_t = (hierarchical_t as 'a, ['a auto_t | 'a user_t | none_t ]) given_t (* with sexp *)
    type appendix_sectional_order_t = (appendix_t as 'a, ['a auto_t | 'a user_t | none_t ]) given_t (* with sexp *)
    type preset_sectional_order_t = (hierarchical_t, none_t) given_t (* with sexp *)
    type wrapper_order_t = (ordinal_t as 'a, ['a auto_t | 'a user_t]) given_t (* with sexp *)
    type ghost_order_t = (ordinal_t as 'a, 'a auto_t) given_t (* with sexp *)
end


It compiles fine.  Now uncomment the "(* with sexp *)" parts, such that it
makes use of the Sexplib syntax extension.  The compilation fails on the
definition of body_sectional_order_t, with an error "type_is_recursive:
unknown type construct".  Is this a known limitation in Type-conv/Sexplib?

One last note to the authors of Sexplib: for each reporting of an issue with
Sexplib there are tons of unreported happy cases.  It is such a great tool
that I find myself using it everywhere, hence the inevitability of every
now and then running into problems...

Thanks again for your attention.
Cheers,
Dario Teixeira