caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: [Caml-list] RFH: type recursion between a class and external functions
Date: Sat, 5 Mar 2016 13:12:32 +0100	[thread overview]
Message-ID: <20160305121232.GA32474@frosties> (raw)

Hi,

are there any nice ways to solve a type recursion between a class and
external functions?

MfG
	Mrvn

---

module Proxy = struct
  type 'a t
end

class ['a] oMainWindow proxy = object
  inherit ['a] OWidget.oWidget proxy
    (*
  method show = show proxy
  method centralWidget =
    let widget_proxy = centralWidget proxy
    in
    new QWidget.qWidget widget_proxy
  method setCentralWidget : 'b . 'b OWidget.oWidget -> unit = fun w ->
    let widget_proxy = w#proxy
    in
    setCentralWidget proxy widget_proxy
    *)
end

external make : unit -> 'a oMainWindow Proxy.t
  = "caml_mrvn_QT5_OMainWindow_make"

let make () =
  let proxy = make ()
  in
  new oMainWindow proxy

external show : 'a oMainWindow Proxy.t -> unit
  = "caml_mrvn_QT5_OMainWindow_show"

let show win =
  let win = win#proxy
  in
  show win

external centralWidget : 'a oMainWindow Proxy.t -> 'b OWidget.oWidget Proxy.t
  = "caml_mrvn_QT5_OMainWindow_centralWidget"

let centralWidget win =
  let win = win#proxy in
  let proxy = centralWidget win
  in
  new OWidget.oWidget proxy

external setCentralWidget : 'a oMainWindow Proxy.t -> 'b OWidget.oWidget Proxy.t -> unit
  = "caml_mrvn_QT5_OMainWindow_setCentralWidget"

let setCentralWidget win w =
  let win = win#proxy in
  let w = w#proxy
  in
  setCentralWidget win w

                 reply	other threads:[~2016-03-05 12:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160305121232.GA32474@frosties \
    --to=goswin-v-b@web.de \
    --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).