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 7E4F97FBCE for ; Tue, 13 Jan 2015 18:10:16 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of thomas.braibant@gmail.com) identity=pra; client-ip=209.85.218.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.braibant@gmail.com"; x-sender="thomas.braibant@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of thomas.braibant@gmail.com designates 209.85.218.54 as permitted sender) identity=mailfrom; client-ip=209.85.218.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.braibant@gmail.com"; x-sender="thomas.braibant@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-oi0-f54.google.com) identity=helo; client-ip=209.85.218.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="thomas.braibant@gmail.com"; x-sender="postmaster@mail-oi0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArAAAElQtVTRVdo2m2dsb2JhbABbg1hYBIMBtz+LTIcEB0MBAQEBAREBAQEBAQYLCwkULoQlEQQZARseAxIQDwImAiQBEQEFASI1h3UBAxENrDGDKT4xiy6Ba4J3ilsKGScNVIMzAQUOgRORR4FBBZIHhUiBDzCEfIl3EiOBDAmBZwwBgh09MQGCQgEBAQ X-IPAS-Result: ArAAAElQtVTRVdo2m2dsb2JhbABbg1hYBIMBtz+LTIcEB0MBAQEBAREBAQEBAQYLCwkULoQlEQQZARseAxIQDwImAiQBEQEFASI1h3UBAxENrDGDKT4xiy6Ba4J3ilsKGScNVIMzAQUOgRORR4FBBZIHhUiBDzCEfIl3EiOBDAmBZwwBgh09MQGCQgEBAQ X-IronPort-AV: E=Sophos;i="5.07,750,1413237600"; d="scan'208";a="96293183" Received: from mail-oi0-f54.google.com ([209.85.218.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 13 Jan 2015 18:10:15 +0100 Received: by mail-oi0-f54.google.com with SMTP id u20so3243306oif.13 for ; Tue, 13 Jan 2015 09:10:14 -0800 (PST) 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=xfQ4aEkvOehFjM3T1Y4DcPANW7iX8t/XQ0a8ciGziIc=; b=A6wyo/vbXLvfKvD+aYfjAwhhDqBTMrmrEmWZGENlvpxY63cH++dJ7ymjSdLMpLtBSV Y8nLIo+MBwhPd5M79E0frbKMYxN/9egFbugcJ7+WfFVTvXz3r7OiMp/leWTItLxqp/bW do2HUCQV7Cn+nmom3lEA2DPQc6PQeHyQfNUTfciqRjo9t0TDSrOFn3xV7FEl+06VECML C591oPMIk/BusoeMbD4o3Np0PyYIvDi9YiE5nb48k/+Vju5B20MWvf3p+OOeEJKxqDDk i3pEl79BirM5rd/mLIpYFFlqWpA7R05RV9s/C8n2H8qlsGZ8d7+5jRsFoFcLV0KT1yba zW/g== X-Received: by 10.202.204.80 with SMTP id c77mr16144190oig.81.1421169014446; Tue, 13 Jan 2015 09:10:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.71.139 with HTTP; Tue, 13 Jan 2015 09:09:54 -0800 (PST) From: Thomas Braibant Date: Tue, 13 Jan 2015 18:09:54 +0100 Message-ID: To: OCaML Mailing List Content-Type: text/plain; charset=UTF-8 Subject: [Caml-list] Quizz Hi list, Here is a quizz that can easily be solved using OCaml (version 4.02.1), but it would be less fun than trying to infer which functions are accepted. ``` module type S = sig val test : 'a list end type t = (module S) let a (x : t) = let module M = (val x) in List.length M.test let b (module M : S) = List.length M.test let c ((module M) : t) = List.length M.test let d (module M : t) = List.length M.test let e (x : (module S)) = let module M = (val x) in List.length M.test let f ((module M) : (module S)) = List.length M.test let g : (module S) -> int = fun (module M) -> List.length M.test let h ((module M) : (module sig val test : 'a list end)) = List.length M.test ``` (I am sure I have missed interesting variations, though.) I have read through http://caml.inria.fr/pub/docs/manual-ocaml/types.html, http://caml.inria.fr/pub/docs/manual-ocaml/modtypes.html http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec230 but what I do not get is how to make a variation of `h` work. That is, I would like to inline the module signature. Is that possible? Best, Thomas