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 55ADE7EFCD for ; Sun, 5 Oct 2014 04:23:16 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=pra; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=mailfrom; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mailhost.math.nagoya-u.ac.jp) identity=helo; client-ip=133.6.130.5; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="postmaster@mailhost.math.nagoya-u.ac.jp"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuIAAM6qMFSFBoIFl2dsb2JhbABfg2FYgwLIJw6HCz4CgRwBEQEBAQEBCBYHQIQEAQEEIx0DATUBAQ4LGAICGA4CAiE2BhOIKgMQDqhweIUIAohQDVeGQQEQAQIEgSyMaB2BYTMHgjZBEiSBHoteileEfYIRgS2GbIcWikNdBYJFAQEB X-IPAS-Result: AuIAAM6qMFSFBoIFl2dsb2JhbABfg2FYgwLIJw6HCz4CgRwBEQEBAQEBCBYHQIQEAQEEIx0DATUBAQ4LGAICGA4CAiE2BhOIKgMQDqhweIUIAohQDVeGQQEQAQIEgSyMaB2BYTMHgjZBEiSBHoteileEfYIRgS2GbIcWikNdBYJFAQEB X-IronPort-AV: E=Sophos;i="5.04,656,1406584800"; d="scan'208";a="99422702" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Oct 2014 04:23:13 +0200 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id F08CC63EB; Sun, 5 Oct 2014 11:23:10 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id A888E4148; Sun, 5 Oct 2014 11:23:10 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=math.nagoya-u.ac.jp; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=alpha; bh=7/KQTBqFVscPzjtFsMxPNkuw7PI=; b=1XH9KOw+tbQgTFRzTkIV2iAElchj +p3OW+R6o3Ma55Lpe6kAlBPT8r47vrRZ4FHILF3YPlhUcgzrdfB0HmWkdy/M26Oe Yx54F9iukHb+7OmtV6swx0RX60JxzA3bLIVkvaR3F4BhK7FdCy48ReYTN6azDE44 4clqcOk3v49aMYA= DomainKey-Signature: a=rsa-sha1; h=Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=jNOh39NNP7E/7SMdFG7dhRQ8PKAcCyGnMqUMZNXI2k++hFE0Bpv6v3/ENvgoeTt7BRZ1VtXpiQutFsQ1QPC/mRZPSNvWytJygjKvwvKc93SbGdGnfdpwxjco2q6xZp1M5xvyjjLWIHB6X+kTnXiYJFGH1UGb708BhXMpnPYLGFk=; c=nofws; d=math.nagoya-u.ac.jp; q=dns; s=alpha Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTPSA id 4327A413C; Sun, 5 Oct 2014 11:23:10 +0900 (JST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) From: Jacques Garrigue In-Reply-To: <20141005004338.6af9622f@xivilization.net> Date: Sun, 5 Oct 2014 11:23:09 +0900 Cc: OCaML List Mailing Content-Transfer-Encoding: quoted-printable Message-Id: References: <20141004150511.7e8de126@xivilization.net> <87a95cklck.fsf@gmail.com> <20141004165458.4efce446@xivilization.net> <20141005004338.6af9622f@xivilization.net> To: Marek Kubica X-Mailer: Apple Mail (2.1878.6) Subject: Re: [Caml-list] [ANN] slacko-0.9.0 On 2014/10/05 07:43, Marek Kubica wrote: >=20 > Hello Gabriel, >=20 > On Sat, 4 Oct 2014 17:23:02 +0200 > Gabriel Scherer wrote: >=20 >> `kick` now returns a [> error_cant_kick | `Success of 'a ], while >> `invite` returns [> error_cant_invite | `Success of 'a ]. >=20 > Thank you for this idea, I was actually looking for a way to define > subsets of polymorphic variants, I didn't know that I can just put them > into other types and was unaware of the # syntax. Now my functions > return just the possible error variants, not all of them anymore. >=20 > I've reworked the code to get rid of the huge apierror type (which I > suppose I can throw away completely, since a user of the API will never > need it anyway), but it lead to quite huge blow-up of signatures: >=20 > >=20 > I am going to simplify these subsets a bit (since e.g. all history > methods use the same polymorphic variants and some possible error types > imply other error types) but it kinda looks very verbose now - any hints > on what can be done? I don=E2=80=99t think it=E2=80=99s particularly verbose. You have documented all the possible errors for each function, which is valuable information, and it would take the same space (or more) if you were to write this in comments. If you think this is hard to read, you can try some factorization, but I=E2= =80=99m not sure it would help. Also, from a stylistic point of view I would write vari= ant definitions on a single line, since there are never more than 3 cases. This said, there is always a tension between safety an complexity. If in practice static checking of possible errors doesn=E2=80=99t matter th= at much, it would be easier to write this code using normal variants. Jacques Garrigue=