From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 5757EBBAF for ; Fri, 29 Oct 2010 23:10:14 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AucJAJDUykxQW+UMgWdsb2JhbACTWIx7fhUBARYiIsAGhUgEkio X-IronPort-AV: E=Sophos;i="4.58,261,1286143200"; d="scan'208";a="85763006" Received: from lo.gmane.org ([80.91.229.12]) by mail1-smtp-roc.national.inria.fr with ESMTP; 29 Oct 2010 23:10:13 +0200 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PBwDD-0005mh-RI for caml-list@inria.fr; Fri, 29 Oct 2010 23:10:11 +0200 Received: from 206-248-170-220.dsl.teksavvy.com ([206.248.170.220]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 Oct 2010 23:10:11 +0200 Received: from monnier by 206-248-170-220.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 Oct 2010 23:10:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Stefan Monnier Subject: Re: Generalized Algebraic Datatypes Date: Fri, 29 Oct 2010 17:10:04 -0400 Message-ID: References: <904846.44200.qm@web111513.mail.gq1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 206-248-170-220.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:MZ3o8lPhVw3nO8ZGPak5H07XP1o= X-Spam: no; 0.00; datatypes:01 bool:01 bool:01 syntax:01 constructors:01 iirc:01 ocaml:01 haskell:01 ocaml:01 constructors:01 curried:01 sml:01 partial:01 partial:01 functions:01 > type _ t = > | IntLit : int -> int t > | BoolLit : bool -> bool t > | Pair : 'a t * 'b t -> ('a * 'b) t > | App : ('a -> 'b) t * 'a t -> 'b t > | Abs : ('a -> 'b) -> ('a -> 'b) t > There's something "Haskellish" about this syntax, in the sense that type > constructors are portrayed as being like functions. Indeed IIRC OCaml does not accept "App" as an expression (you have to provide arguments to the construct). Maybe this is a good opportunity to lift this restriction. > While this does make sense in Haskell, in Ocaml it feels a bit out of > place, because you cannot, for example, partially apply > a type constructor. The types above don't allow partial applications either. They use the OCaml/SML style of constructors were partial application is not possible because the various arguments are not provided in a curried way. Stefan