From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0080F7FACB for ; Wed, 3 Sep 2014 19:21:26 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yotambarnoy@gmail.com) identity=pra; client-ip=209.85.216.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yotambarnoy@gmail.com designates 209.85.216.53 as permitted sender) identity=mailfrom; client-ip=209.85.216.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qa0-f53.google.com) identity=helo; client-ip=209.85.216.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="postmaster@mail-qa0-f53.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEBABhNB1TRVdg1m2dsb2JhbABZhDcEgnjOJQgWEAEBAQEBBgsLCRQphBwRBBkBGx4DEgkHNwIkAREBBQEWDDWICwEDEZkrgxlriyuBcoMQigwKGScNZoUqAREBBQ6SP4FTBY8ejT+TLBgphS4hL4JPAQEB X-IPAS-Result: AoEBABhNB1TRVdg1m2dsb2JhbABZhDcEgnjOJQgWEAEBAQEBBgsLCRQphBwRBBkBGx4DEgkHNwIkAREBBQEWDDWICwEDEZkrgxlriyuBcoMQigwKGScNZoUqAREBBQ6SP4FTBY8ejT+TLBgphS4hL4JPAQEB X-IronPort-AV: E=Sophos;i="5.04,458,1406584800"; d="scan'208";a="77643224" Received: from mail-qa0-f53.google.com ([209.85.216.53]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 03 Sep 2014 19:21:26 +0200 Received: by mail-qa0-f53.google.com with SMTP id w8so8050627qac.40 for ; Wed, 03 Sep 2014 10:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=veQK+bNTaUbXY00RpPlDA0e/RO9nmyhIhRT/wHEFxIs=; b=HJeC3BlYAWQffIo5/8WJIAT9fIn4tNnjahnys3+FEoFfHWAFjosnu9ggsmRucvjh7V KEqgE0MmIyhOpXNd3eYmjY3pxRUtMNCLPoZ0+jTh4SySex2uTXtQSRBLv7MfvW1lXm6n KsoIcG5wO1xkOjJayIjqJtyRDv33Ba3cvQqWPAn27VGdr1lrApOv34EKaIqs6By4NoPs cYlGiI5d7n4xQDf/hkq5/zP+VZ8OyT1CTAjBy8O4eOzh+S6CdHHtsRMrMPjvBV78wg+e f73D1arvR1Ss7Zr5ayFOfx9Bh3uqjftKClVtiPh3TORwR3MHADd9bx4uDM8GcjKqEEdS 4rbA== X-Received: by 10.224.161.11 with SMTP id p11mr68812254qax.40.1409764879383; Wed, 03 Sep 2014 10:21:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.174.68 with HTTP; Wed, 3 Sep 2014 10:20:59 -0700 (PDT) From: Yotam Barnoy Date: Wed, 3 Sep 2014 13:20:59 -0400 Message-ID: To: Ocaml Mailing List Content-Type: multipart/alternative; boundary=089e0149d2e8da459f05022c7694 Subject: [Caml-list] help with functors --089e0149d2e8da459f05022c7694 Content-Type: text/plain; charset=UTF-8 Working with ocaml's functional data structures has quickly become a job of connecting different functors together, and I'd appreciate some help. I have the following layout: module rec OrderedKey : OrderedKeyType = struct type t = Value.value_t let compare = compare let filter_idxs idxs = function | Value.VTuple l -> Value.VTuple(list_filter_idxs idxs l) | _ -> invalid_arg "not a vtuple" end and ValueBag : IBag.S with type elt = Value.value_t = IBag.Make(OrderedKey) and ValueMMap : IMultimap.S with type elt = Value.value_t and type bag = ValueBag.t = IMultimap.Make(OrderedKey) and Value : sig ... type value_t = ... end = Value The situation is as such: my multimap (IMultimap) contains an internal specialization of the IBag functor called an InnerBag. It attempts to return said bag, which is equivalent to the external ValueBag in structure. However, I don't know how to tell ocaml that the type 'bag' which is abstract in IMultimap is exactly the same as the external ValueBag. I tried to do that above, but what I get is a mismatch between IMultimap's internal InnerBag.t and the external ValueBag.t. Any help would be appreciated. Yotam --089e0149d2e8da459f05022c7694 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Working with ocaml's functional data structures has qu= ickly become a job of connecting different functors together, and I'd a= ppreciate some help.

I have the following layout:

module rec OrderedKey : OrderedKeyType =3D struct<= /div>
=C2=A0 =C2=A0 type t =3D Value.value_t
=C2=A0 =C2=A0 le= t compare =3D compare
=C2=A0 =C2=A0 let filter_idxs idxs =3D func= tion
=C2=A0 =C2=A0 =C2=A0 | Value.VTuple l -> Value.VTuple(lis= t_filter_idxs idxs l)
=C2=A0 =C2=A0 =C2=A0 | _ -> invalid_arg "not a vtuple"
=C2=A0 =C2=A0 end

and ValueBag : IBag.S wi= th type elt =3D Value.value_t =3D
=C2=A0 IBag.Make(OrderedKey)

and ValueMMap : IMultimap.S with type elt =3D Value.= value_t and type bag =3D ValueBag.t =3D
=C2=A0 IMultimap.Make(OrderedKey)

and Value := sig ... type value_t =3D ... end =3D Value

= The situation is as such: my multimap (IMultimap) contains an internal spec= ialization of the IBag functor called an InnerBag. It attempts to return sa= id bag, which is equivalent to the external ValueBag in structure. However,= I don't know how to tell ocaml that the type 'bag' which is ab= stract in IMultimap is exactly the same as the external ValueBag. I tried t= o do that above, but what I get is a mismatch between IMultimap's inter= nal InnerBag.t and the external ValueBag.t.

Any help would be appreciated.

Yotam

--089e0149d2e8da459f05022c7694--