caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yotam Barnoy <yotambarnoy@gmail.com>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] help with functors
Date: Thu, 4 Sep 2014 09:53:57 -0400	[thread overview]
Message-ID: <CAN6ygOkSJKPfRDnddzuZLRhWuL=ikkFDHcr9eAczdY9vgcffLw@mail.gmail.com> (raw)
In-Reply-To: <CAN6ygO=vtkwozSyY4pDEpxVAPyUGh3AaoK3-YbmeND9EcDA0tw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

Here's an attempt to clarify the question:

I have a functor F and a functor G. I apply F to module M outside of G to
create F', and within G I also apply F to M to create F''. Additionally, G
is applied to M to create G'. How do I make the compiler understand that F'
outside G' is the same as F'' inside G'?

Yotam


On Wed, Sep 3, 2014 at 1:20 PM, Yotam Barnoy <yotambarnoy@gmail.com> wrote:

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 2439 bytes --]

  reply	other threads:[~2014-09-04 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 17:20 Yotam Barnoy
2014-09-04 13:53 ` Yotam Barnoy [this message]
     [not found]   ` <CAPFanBHS1-DiuitQpGwX_Z=tiNm6_bJd8m=+S0XT2gvixBeFQA@mail.gmail.com>
     [not found]     ` <CAN6ygOnZP9SOYiN1mPN3ZLQ9cT8F6pgyDctcj4OxUXyqfwmUuA@mail.gmail.com>
2014-09-05  1:39       ` Yotam Barnoy
2014-09-05  2:41         ` Yotam Barnoy

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='CAN6ygOkSJKPfRDnddzuZLRhWuL=ikkFDHcr9eAczdY9vgcffLw@mail.gmail.com' \
    --to=yotambarnoy@gmail.com \
    --cc=caml-list@inria.fr \
    /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).