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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 79D327F30A for ; Tue, 12 Mar 2013 22:57:57 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mmatalka@gmail.com) identity=pra; client-ip=209.85.210.46; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of mmatalka@gmail.com designates 209.85.210.46 as permitted sender) identity=mailfrom; client-ip=209.85.210.46; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-da0-f46.google.com) identity=helo; client-ip=209.85.210.46; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="postmaster@mail-da0-f46.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhACAFmkP1HRVdIuiGdsb2JhbABDhCrCExYOAQEBCgkUFAQkglcZARseAxImNAEEDxEBBQGINgEDDwGgS4JyjDKBcYEKhDkKGScNWYh8AQUMjx6DKgOXdY11P4RJ X-IPAS-Result: AhACAFmkP1HRVdIuiGdsb2JhbABDhCrCExYOAQEBCgkUFAQkglcZARseAxImNAEEDxEBBQGINgEDDwGgS4JyjDKBcYEKhDkKGScNWYh8AQUMjx6DKgOXdY11P4RJ X-IronPort-AV: E=Sophos;i="4.84,833,1355094000"; d="scan'208";a="7129391" Received: from mail-da0-f46.google.com ([209.85.210.46]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 12 Mar 2013 22:57:56 +0100 Received: by mail-da0-f46.google.com with SMTP id z8so118146dad.5 for ; Tue, 12 Mar 2013 14:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=o3b7dYG/aeDagtCsZ54En2NEWw/Sb5s7c8aaK7TVN3o=; b=mk1YF+rV3lo9BuvLaW+NOY7PdH7reSe+drANoOtbnfc+Avv5CE+s2eVlAw5AWJ+aVI uFVmHeRb0XyjIu098BGXHQZQ1rjanmU6e1lg/n8KopwOAS8f5StrC1YJOaAiW2yCTcV4 gG6uvI9xpcBUBPq3CwO5BAW8yQrqu7ScIFxR4J/wFR/TCuWeL08JfNoIZ6xW39FIa6lG aI7QxklfarDNFrUkrjF2sqZqy7azn/h2yMXnb0VyVoLdB7Bl6R7+pCx/sVtXK2XW0Wj+ 3pOdayDlxtwfk9a78Gt7hEiBt/vjReMxacRlM7GLf0UbMI1nxZbck95I25Efb2vnfS6e YC7Q== X-Received: by 10.68.197.133 with SMTP id iu5mr39945964pbc.195.1363125474757; Tue, 12 Mar 2013 14:57:54 -0700 (PDT) Received: from localhost ([2a01:7e00::f03c:91ff:fedf:4d21]) by mx.google.com with ESMTPS id z1sm3868809pbw.19.2013.03.12.14.57.52 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 12 Mar 2013 14:57:53 -0700 (PDT) From: Malcolm Matalka To: caml-list@inria.fr Date: Tue, 12 Mar 2013 17:57:50 -0400 Message-ID: <87ip4wffhd.fsf@li195-236.members.linode.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: [Caml-list] Type variables and polymorphic variants Hello! I use polymorphic variants extensively in my code for getting the compiler to make sure I handle errors. However, I'm trying to write the following function which is proving hard, the errors are below. I have come across similar issues before and it is related to the type variable. I believe the problem is the [> in error because it can't know if I return a polymorphic variant in this function if that is the error or not. What is the cleanest way to write this function? val with_conn : host:string -> port:int -> (unit -> ('a, [> error ]) Deferred.Result.t) -> ('a, [> error ]) Deferred.Result.t Error: The implementation conn.ml does not match the interface conn.cmi: Values do not match: val with_conn : host:string -> port:int -> (unit -> ('a, [> `Bad_conn ] as 'b) Core.Std._result Async_core.Deferred.t) -> ('a, 'b) Core.Std._result Async_core.Deferred.t is not included in val with_conn : host:string -> port:int -> (unit -> ('a, [> error ]) Async.Std.Deferred.Result.t) -> ('a, [> error ]) Async.Std.Deferred.Result.t Thanks! /Malcolm