Re: Re: [Caml-list] Dependent types ?

2011-09-26 Thread Denis Berthod
Sorry, foo = add -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs

Re: [Caml-list] Dependent types ?

2011-09-26 Thread Yaron Minsky
As written, the behavior of the types might not be what you expect, since addition of two 16 bit ints may result in an int that requires 17 bits. When using phantom types, you need to be especially careful that the types mean what you think they mean. On Sep 26, 2011 8:13 AM, Denis Berthod

Re: [Caml-list] Dependent types ?

2011-09-26 Thread Jocelyn Sérot
Thanks to all for your answers. Phantom types could be a solution but we must declare a new type for each possible size, which is cumbersome / annoying. Moreover, since i'm writing a DSL, the fact that they do not require a modification to the existing type system is not really an

Re: [Caml-list] Dependent types ?

2011-09-26 Thread Gabriel Scherer
Phantom types could be a solution but we must declare a new type for each possible size, which is cumbersome / annoying. If you define the type system yourself, you can easily add a family of type constants `sizen` (with `n` an integer literal) to the default environment of the type checker.

Re: [Caml-list] Dependent types ?

2011-09-26 Thread oliver
On Mon, Sep 26, 2011 at 01:42:51PM +0200, Jocelyn Sérot wrote: Hello, I've recently come across a problem while writing a domain specific language for hardware synthesis (http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/caph.html [...] Very interesting. I also once thought