From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id DD64F2DF6 for ; Wed, 21 Mar 2018 14:37:36 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,340,1517871600"; d="scan'208,217";a="319262469" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 21 Mar 2018 15:37:23 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 5C951823F7; Wed, 21 Mar 2018 15:37:23 +0100 (CET) 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 26733823D7 for ; Wed, 21 Mar 2018 15:37:08 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=lukstafi@gmail.com; spf=Pass smtp.mailfrom=lukstafi@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f50.google.com IronPort-PHdr: =?us-ascii?q?9a23=3A9H2jOR+lLuOL3f9uRHKM819IXTAuvvDOBiVQ1KB3?= =?us-ascii?q?0eMcTK2v8tzYMVDF4r011RmVBd6ds6oMotGVmpioYXYH75eFvSJKW713fDhBt/?= =?us-ascii?q?8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1?= =?us-ascii?q?Ifn+FpLPg8it2O2+55Pebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+?= =?us-ascii?q?RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTF?= =?us-ascii?q?UACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMNboRr4oRzut86ZrSAfpiC?= =?us-ascii?q?gZMT457HrXgdF0gK5CvR6tuwBzz4vSbY6SKfR+Y7jdfcsESmVdQsZfWStBAoam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QJZhQlFg=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AvAADDbbJahjJSfUpdGgEBAQEBAgEBA?= =?us-ascii?q?QEIAQEBAYQTC3AoCoNSUkuGYo0MgXGBEIE/hhuGSIUGggkLI4RiAoNOBxkHAQQ?= =?us-ascii?q?wGAECAQEBAQEBAQEBEgEBAQgLCwgoL4I4JIJJAQEBAwEjHQEbEgsBAwELBgMCB?= =?us-ascii?q?AcNDR0CAiIBEQEFAQoSBhMShGMBAwgFCA+PYY94PIsFggEFARmCcgWDTgoZJgM?= =?us-ascii?q?KVVeCBgIGEocxgVNAhBiDCAsEgTlTglSCVAOGGwiSGAmGDoVSg1SBYCWLK4kzh?= =?us-ascii?q?nQPAx6BBQwQggpNIxU6MYISCYFoJBqOIT8wAY0pgkQBAQ?= X-IPAS-Result: =?us-ascii?q?A0AvAADDbbJahjJSfUpdGgEBAQEBAgEBAQEIAQEBAYQTC3A?= =?us-ascii?q?oCoNSUkuGYo0MgXGBEIE/hhuGSIUGggkLI4RiAoNOBxkHAQQwGAECAQEBAQEBA?= =?us-ascii?q?QEBEgEBAQgLCwgoL4I4JIJJAQEBAwEjHQEbEgsBAwELBgMCBAcNDR0CAiIBEQE?= =?us-ascii?q?FAQoSBhMShGMBAwgFCA+PYY94PIsFggEFARmCcgWDTgoZJgMKVVeCBgIGEocxg?= =?us-ascii?q?VNAhBiDCAsEgTlTglSCVAOGGwiSGAmGDoVSg1SBYCWLK4kzhnQPAx6BBQwQggp?= =?us-ascii?q?NIxU6MYISCYFoJBqOIT8wAY0pgkQBAQ?= X-IronPort-AV: E=Sophos;i="5.48,340,1517871600"; d="scan'208,217";a="259289939" Received: from mail-wm0-f50.google.com ([74.125.82.50]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 21 Mar 2018 15:36:52 +0100 Received: by mail-wm0-f50.google.com with SMTP id r82so10305132wme.0 for ; Wed, 21 Mar 2018 07:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OXZPRG5Kg+T8cjZgDFdHwZ0Xc4gs2dhZgxupCR1t5Yg=; b=GbWzwq2cc0ZrZETiJexZ6++TtQCN+G9ZW1mbxv5plc+lTqJJdaQwjd1luqs+D3dGoW nQAWetQ2EQLkwhcQU+J2EtC0q3PnkWP5mvJJn0X4uEIZF2oXouLffMs5t+ven8a4lw3z sJsFgCgGXhtCaLQNLUDyz9xVT3zlXmIQvlCIQcw2rtHudqBjD7WOIUv4qMze/rjKUPwF SCVD+C7a9sHWaB3Jk41wcG+VWpY8vDgFOMMKNONPnvcnd8BY8gEOzL2Qv6DVWfHrFqB/ 0KtgGFb0O/gbDAUoYQmRpJIYj8Ga3VjwkNV+svW3afKpmFhuA1B/SCgDmTjghokIQntY 4oJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=OXZPRG5Kg+T8cjZgDFdHwZ0Xc4gs2dhZgxupCR1t5Yg=; b=Qms2asdxJfhS0U40bUJZYyYThYAI2saF4KNqrZh+k2PtvJLIG8EwNtABEXKa7hlouv QsMvTa0KQVxdGJy7bg8V+o5ykJ8M+kiThHC75Ei4QqcL6Ns9Gg+1xlXAPmvQRgYd8H6a m+tayQwm3tEfsDca4m/9IlDOzfsbBS16fpCgdBTh5jO8vBE3wN+mPeCkHAg1PN24XkWP sCQqioxEOMpq8kZoiJ68UATJVtKVJ+kKE6KBeqyHNk48TE0s9ZiyE4S3/UnTDy3YLGhp EkFLb6NaW7ilEE3S0kleVHaeIbwv+KKijn68iQjPen2v8+KmAHt4wwM0fROshWASOZ2t yo4A== X-Gm-Message-State: AElRT7EFhSF5TIvKA4RPaBOHnEs3l1UB2iegJx0gw6P1zQ/Ob1dzr56+ fHRuQ6nUaCn95+fukCC/nVnHfK8XjSwRUhQxpGbR6A== X-Google-Smtp-Source: AG47ELtrwM8t65UJqanyjquhebNdzMqgz1L/hCvCfJ2ntWCf2znU25PdJFG254BMkEoRB7NL5D9MSh1AP79aERDPOJ0= X-Received: by 10.28.74.16 with SMTP id x16mr2876048wma.36.1521643012322; Wed, 21 Mar 2018 07:36:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.144.10 with HTTP; Wed, 21 Mar 2018 07:36:31 -0700 (PDT) In-Reply-To: <20180319212449.htqtzkkw55oj7fsf@darkstar> References: <20180319212449.htqtzkkw55oj7fsf@darkstar> From: Lukasz Stafiniak Date: Wed, 21 Mar 2018 15:36:31 +0100 Message-ID: To: SP Cc: Bahman Movaqar , Caml Content-Type: multipart/alternative; boundary="001a114d2232397f680567ed1f24" Subject: Re: [Caml-list] On variants, integers and testing Reply-To: Lukasz Stafiniak X-Loop: caml-list@inria.fr X-Sequence: 16742 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --001a114d2232397f680567ed1f24 Content-Type: text/plain; charset="UTF-8" You could also consider private type abbreviations: https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec236 On Mon, Mar 19, 2018 at 10:24 PM, SP wrote: > On Fri, Mar 16, 2018 at 12:12:56PM +0100, Bahman Movaqar wrote: > >> To limit the values possible for a card's actual value, I defined `Value` >> module (line 6) which basically maps a variant to integer values. >> Is this the idiomatic approach? Is there something like Java's enum or >> Pascal's subranges that I could use[1]? >> > > Sicne I didn't notice anyone else answering this, yes the reason and way > you wrote Value looks normal. There are preprocessors that can automate > repetitive mappings, but I don't think they are an option to consider > lightly. > > The rest of the code looked normal too, but I'm not familiar with the > domain to help more. > > -- > SP > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs --001a114d2232397f680567ed1f24 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You could also consider private type abbreviations:

O= n Mon, Mar 19, 2018 at 10:24 PM, SP <sp@orbitalfox.eu> wrote:=
On Fri, Mar 16, 2018 at= 12:12:56PM +0100, Bahman Movaqar wrote:
To limit the values possible for a card's actual value, I defined `Valu= e`
module (line 6) which basically maps a variant to integer values.
Is this the idiomatic approach? Is there something like Java's enum or<= br> Pascal's subranges that I could use[1]?

Sicne I didn't notice anyone else answering this, yes the reason and wa= y you wrote Value looks normal. There are preprocessors that can automate r= epetitive mappings, but I don't think they are an option to consider li= ghtly.

The rest of the code looked normal too, but I'm not familiar with the d= omain to help more.

--
=C2=A0 =C2=A0 =C2=A0 =C2=A0 SP


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a114d2232397f680567ed1f24--