Loading ...
Sorry, an error occurred while loading the content.
 

help with type inference - ayuda con inferencia de tipos

Expand Messages
  • wences_correo
    I had thinking about this and I can t find the solution : What means _a list maybe something like ( a a) list ????? # (function x - function y - x@y) [];; -
    Message 1 of 2 , Dec 7, 2003
      I had thinking about this and I can't find the solution :

      What means '_a list maybe something like ('a'a) list ?????

      # (function x -> function y -> x@y) [];;
      - : '_a list -> '_a list = <fun>


      # (function x -> function y -> x@y) [] 1;;
      This expression has type int but is here used with type 'a list

      Well I supose it's the same tha 'a list -> 'a list

      Is this true??? If so why caml say the first expresion has type
      '_a list -> '_a list. It looks a nosense

      How he/she inference this type for this expresion??

      Thanks
    • Richard Jones
      ... The meaning of _a is explained here: http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles Rich. -- Richard Jones.
      Message 2 of 2 , Dec 8, 2003
        On Mon, Dec 08, 2003 at 05:37:07AM -0000, wences_correo wrote:
        > I had thinking about this and I can't find the solution :
        >
        > What means '_a list maybe something like ('a'a) list ?????
        >
        > # (function x -> function y -> x@y) [];;
        > - : '_a list -> '_a list = <fun>
        >
        >
        > # (function x -> function y -> x@y) [] 1;;
        > This expression has type int but is here used with type 'a list
        >
        > Well I supose it's the same tha 'a list -> 'a list
        >
        > Is this true??? If so why caml say the first expresion has type
        > '_a list -> '_a list. It looks a nosense
        >
        > How he/she inference this type for this expresion??

        The meaning of '_a is explained here:

        http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles

        Rich.

        --
        Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
        Merjis Ltd. http://www.merjis.com/ - improving website return on investment
        C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes,
        trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/
      Your message has been successfully submitted and would be delivered to recipients shortly.