Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: "ocaml_beginners"::[] Syntax for polymorphic methods
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lukasz Stafiniak <lukstafi@g...>
Subject: Re: "ocaml_beginners"::[] Syntax for polymorphic methods
On 2/26/07, Geoffrey Romer <geoff.romer@gmail.com> wrote:
>
> So what's the difference between 'a. <stuff> and just plain <stuff>? Aren't
>  type variables implicitly universally quantified (i.e. isn't the whole point
>  of a polymorphic type that it applies for any possible 'a)?
>
You've got me here...

        Objective Caml version 3.09.3

# type pty = {pv : 'a . 'a list};;
type pty = { pv : 'a. 'a list; }
# let px = {pv = []};;
val px : pty = {pv = []}
# match px with
    {pv=[]} -> "OK"
  | {pv=5::_} -> "int"
  | {pv=true::_} -> "bool";;
      Fatal error: exception Assert_failure("typing/parmatch.ml", 784, 55)

Process caml-toplevel exited abnormally with code 2