Hi all,

On Wed, 28 Sep 2011, Jacques Garrigue wrote:

On 2011/09/28, at 5:22, Walter Cazzola wrote:

I still have one problem: how can I assign to a the type 'a list? by
using «type a= 'a list» I get

 Error: Unbound type parameter 'a

Same thing: you need to make explicit the contents of the list.
So this can be type a = int list.
On the other hand if you are trying to refine the signature, you
can also write
 type t
 type a = t list
keeping t abstract.

thanks for the explanation but I'm still unable to match the 2 types (I
have attached the code again). I get this message:
    # module M0 = Continuation(StringConcat);;
    Error: Signature mismatch:
           Modules do not match:
             sig
               type t = StringConcat.t
               type a = t list
               and b = t
               and c = t list
               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

I have also tried to set the abstract type t to string butwithout any
luck.

    # module M0 = Continuation(StringConcat with StringConcat.t = string) ;;
    Error: Syntax error

I feel myself quite dumb but I can't figure out how to fix it.

Walter

--
--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

module Continuation (OP : OpVarADT.OpVarADT) = 
  struct
    let arg x = fun y continuation -> continuation (OP.op x y) ;;
    let stop x = x;;
    let f g = g OP.init;;
  end
module type OpVarADT = 
 sig
   type a and b and c
   val op: a -> b -> c
   val init : c
 end
module StringConcat = struct
  type t
  type a=t list and b=t and c=t list
  let op = fun x y -> y @ [x] ;;
  let init = [] ;;
end

Reply via email to