caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Walter Cazzola <cazzola@dico.unimi.it>
Cc: OCaML Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] still silly issues on polymorphic types
Date: Tue, 27 Sep 2011 22:16:36 +0900	[thread overview]
Message-ID: <6A020199-D53D-443E-9683-D225D495AEB5@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <alpine.LFD.2.00.1109271335550.8918@surtur.dico.unimi.it>

On 2011/09/27, at 20:46, Walter Cazzola wrote:

> Dear all,
> I'm still playing around with functors, modules and polymorphism but
> I've some problems with this last concept.
> 
> In the attached files I have tried to implement a sort of function with
> a variable number of arguments (based on continuation) and to generalize
> the approach I've used a functor (OpVarADT) where I defined the
> operation of type 'a -> 'b -> 'c but seems that it is not general enough
> to contain int->int->int or 'a -> 'a list -> 'a list
> 
> This is the functor instantiation with the errors I get:
> 
>  # module M0 = Continuation(StringConcat) ;;
>  Error: Signature mismatch:
>         Modules do not match:
>           sig val op : 'a -> 'a list -> 'a list val init : 'a list end
>         is not included in
>           OpVarADT.OpVarADT
>         Values do not match:
>           val op : 'a -> 'a list -> 'a list
>         is not included in
>           val op : 'a -> 'b -> 'c

It seems that your continuation functor has not the right specification.
Namely, there is no way you can provide a meaningful function of
type 'a -> 'b -> 'c (i.e. a -> b -> c for all possible a, b, and c)
other than raising an exception or going into an infinite loop.
I think that you meant something else, like

type a and b and c
val op : a -> b -> c

which would let you give a specific function for op.

Jacques Garrigue


  parent reply	other threads:[~2011-09-27 13:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 11:46 Walter Cazzola
2011-09-27 12:57 ` Christophe Papazian
2011-09-27 13:49   ` Walter Cazzola
2011-09-27 15:26     ` Christophe Papazian
2011-09-27 18:43       ` Walter Cazzola
2011-09-27 19:25         ` Thibault Suzanne
2011-09-27 13:16 ` Jacques Garrigue [this message]
2011-09-27 13:58   ` Walter Cazzola
2011-09-27 19:45     ` Pierre Chopin
2011-09-27 20:22       ` Walter Cazzola
2011-09-27 23:58         ` Jacques Garrigue
     [not found]         ` <266E7048-C3BB-4B9E-9760-9D52993A1C86@math.nagoya-u.ac.jp>
2011-09-29 10:27           ` Walter Cazzola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6A020199-D53D-443E-9683-D225D495AEB5@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=cazzola@dico.unimi.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).