Oh, the humanity!


Labelled and optional arguments, and polymorphic variants rank among Ocaml's most interesting features. They can lead, however, to some pretty funky error messages. Here's one example:

File "main.ml", line 160, characters 38-44:
Error: This expression has type
         (unit, unit,
          [ `Attached of
              [ `Internal of ([< `Coservice | `Service ] as 'a) * [ `Get ] ]
              Eliom_services.a_s ],
          [< Eliom_services.suff ] as 'b, 'c, unit, [ `Registrable ])
         Eliom_services.service ->
         (Eliom_sessions.server_params ->
          ('d, Litiom_blocks.out_t) Litiom_blocks.t ->
          Eliom_predefmod.Xhtml.page Lwt.t) ->
         (unit, unit,
          [ `Attached of
              [ `Internal of [< `Coservice | `Service ] * [ `Get ] ]
              Eliom_services.a_s ],
          [< Eliom_services.suff ] as 'e, 'f, unit, [ `Registrable ])
         Eliom_services.service ->
         (Eliom_sessions.server_params ->
          ('g, Litiom_blocks.out_t) Litiom_blocks.t ->
          Eliom_predefmod.Xhtml.page Lwt.t) ->
         carry:unit ->
         Eliom_sessions.server_params ->
         (unit, int,
          [> `Attached of
               [> `Internal of [> `Coservice ] * [> `Post ] ]
               Eliom_services.a_s ],
          'e, 'f, [ `One of int ] Eliom_parameters.param_name,
          [> `Registrable ])
         Eliom_services.service
       but is here used with type
         (unit, unit,
          [ `Attached of [ `Internal of 'a * [ `Get ] ] Eliom_services.a_s ],
          'b, 'c, unit, [ `Registrable ])
         Eliom_services.service ->
         (Eliom_sessions.server_params ->
          ('d, Litiom_blocks.out_t) Litiom_blocks.t ->
          Eliom_predefmod.Xhtml.page Lwt.t) ->
         carry:unit ->
         Eliom_sessions.server_params ->
         (unit, 'h, [< Eliom_services.post_service_kind ],
          [< Eliom_services.suff ], 'i,
          [< int Eliom_parameters.setoneopt ] Eliom_parameters.param_name,
          [< Eliom_services.registrable ])
         Eliom_services.service

Obvious, isn't?

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this entry.
Comments
  • No comments exist for this entry.
Leave a comment

 Enter the above security code (required)

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.