• [^] # Re: Un peu faible

    Posté par (site web personnel) . En réponse au journal Les types fantômes. Évalué à 2.

    C'est très bizarre ! Voici mon transcript :

    $ ocaml
     OCaml version 4.00.0
    # module Foo : sig
     type 'a foo
     val inject : 'a -> 'a foo
    end = struct
     type 'a foo = 'a
     let inject x = x
    end ;; 
    module Foo : sig type 'a foo val inject : 'a -> 'a foo end
    # Foo.inject [];;
    - : '_a list Foo.foo = <abstr>
    # Foo.inject 6;; 
    - : int Foo.foo = <abstr>
    # module Foo : sig
     type +'a foo
     val inject : 'a -> 'a foo
    end = struct
     type 'a foo = 'a
     let inject x = x
    end ;; 
    module Foo : sig type +'a foo val inject : 'a -> 'a foo end
    # Foo.inject [];;
    - : 'a list Foo.foo = <abstr>
    # Foo.inject 6;; 
    - : int Foo.foo = <abstr>
    # 
    
    

    « Il n’y a pas de choix démocratiques contre les Traités européens » - Jean-Claude Junker