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 sympa.inria.fr (Postfix) with ESMTPS id AD8327FC18 for ; Sun, 15 Feb 2015 14:35:37 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of nicolas.boulay@gmail.com) identity=pra; client-ip=209.85.223.179; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="nicolas.boulay@gmail.com"; x-sender="nicolas.boulay@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of nicolas.boulay@gmail.com designates 209.85.223.179 as permitted sender) identity=mailfrom; client-ip=209.85.223.179; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="nicolas.boulay@gmail.com"; x-sender="nicolas.boulay@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-ie0-f179.google.com) identity=helo; client-ip=209.85.223.179; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="nicolas.boulay@gmail.com"; x-sender="postmaster@mail-ie0-f179.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ADAgAhoOBUm7PfVdFbhDIEgn/GMQdDAQEBAQEBEAEBAQEBBgsLCRQuhCURBBkBOQMNBQkBBjcCJBIBBQEWDBsah3cDEahygys+MYsuhGKLZScNhWwBBQ6SWoFCBZhvkUMSI4EVW4EMDDEcgVE9MYJDAQEB X-IPAS-Result: A0ADAgAhoOBUm7PfVdFbhDIEgn/GMQdDAQEBAQEBEAEBAQEBBgsLCRQuhCURBBkBOQMNBQkBBjcCJBIBBQEWDBsah3cDEahygys+MYsuhGKLZScNhWwBBQ6SWoFCBZhvkUMSI4EVW4EMDDEcgVE9MYJDAQEB X-IronPort-AV: E=Sophos;i="5.09,581,1418079600"; d="scan'208";a="121832334" Received: from mail-ie0-f179.google.com ([209.85.223.179]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 15 Feb 2015 14:35:37 +0100 Received: by iecrd18 with SMTP id rd18so28960326iec.5 for ; Sun, 15 Feb 2015 05:35:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=OFDjIRB8epWAevKT76/IJ3bncbTZOhPB8jG/WZi9b7Y=; b=JF9nRdkaQrXhl2EqBY14sRNc2YWqCM4htXaPqhBGx5ZDK+lNurYnitphIPMAK7Sz86 YHxH/upymPkmGBrY2mXcTDecE3B+VTHQIG8g4yKMFukTZQ4seCyfZ0X1jcebQuHVeIsl 8r05uIUAVh+a1dzI1usnCL/hRQMj6R1MUpw4YfQwq/hU0I+wAjrnrLBuLQrm/3fn64Q6 dXo0cphAQpKMahVuu15qBdAXLJz+KmtZhHezdzY21yaN2V6rAo11weNibXfiYXfDqYbz YR1Us3bCJ8JOvisc4dPXePHQQ16rlzYrYxAamPn/BtzrKHY/zxPB8ZrPj4jLGiQzhYuj DmPQ== MIME-Version: 1.0 X-Received: by 10.107.138.91 with SMTP id m88mr23864221iod.25.1424007335923; Sun, 15 Feb 2015 05:35:35 -0800 (PST) Sender: nicolas.boulay@gmail.com Received: by 10.50.132.194 with HTTP; Sun, 15 Feb 2015 05:35:35 -0800 (PST) Date: Sun, 15 Feb 2015 14:35:35 +0100 X-Google-Sender-Auth: VU9pk8rwQXqQEVobuEFSJirkLx0 Message-ID: From: Nicolas Boulay To: OCaml Mailing List Content-Type: multipart/alternative; boundary=001a113f19e66a60e9050f208b04 X-Validation-by: nicolas@boulay.name Subject: [Caml-list] problem to use gadt --001a113f19e66a60e9050f208b04 Content-Type: text/plain; charset=UTF-8 I try to define my own type system using gadt. But it seems that is complex to mix both type system : mine and the ocaml one. This tiny example did not compile: type _ t = | Or: _ t * _ t -> _ t | Int : int t | Float : float t let a = Or (Int, Float) (*is ok*) let (||) a b = Or (a, b) let aa = Int || Float (*Error: '_a t, contains type variable that cannot be generalized*) Using an operator make a difference. But how to exprime "don't care" if a choice between 2 types is not possible to be define. It could be nice if "('a | 'b) t" worked :) Should i use normal sum type, and make all type check by a function ? Nicolas Boulay --001a113f19e66a60e9050f208b04 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I try to defi= ne my own type system using gadt. But it seems that is complex to mix both = type system : mine and the ocaml one.

This tiny example did no= t compile:

type _ t =3D
=
=C2=A0| Or: _ t * _ t= -> _ t
= =C2=A0| Int : int t
=C2=A0| Float : float t

let a =3D Or (Int, Float)=C2=A0 (*is ok*)

=
let (||)=C2=A0= a b =3D Or (a, b)

let aa =3D Int || Float (*Error: '_a t, contains type varia= ble that cannot be generalized*)

Using an operator make a dif= ference. But how to exprime "don't care" if a choice between = 2 types is not possible to be define.=C2=A0 It could be nice if "('= ;a | 'b) t" worked :) Should i use normal sum type, and make all t= ype check by a function ?

Nicolas Boulay
--001a113f19e66a60e9050f208b04--