From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p37Lnv3O012712 for ; Thu, 7 Apr 2011 23:49:57 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiwCAHownk3U436rkGdsb2JhbACES6FFFAEBAQEJCQ0HFAMiiHmnRpB2AoEng0x4BIhaiFM X-IronPort-AV: E=Sophos;i="4.63,319,1299452400"; d="scan'208";a="96525356" Received: from moutng.kundenserver.de ([212.227.126.171]) by mail2-smtp-roc.national.inria.fr with ESMTP; 07 Apr 2011 23:49:52 +0200 Received: from office1.lan.sumadev.de (dslb-094-219-218-046.pools.arcor-ip.net [94.219.218.46]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MJYNz-1Q5UF23rQ3-0037hc; Thu, 07 Apr 2011 23:49:52 +0200 Received: from [192.168.5.106] (dslb-094-219-218-046.pools.arcor-ip.net [94.219.218.46]) by office1.lan.sumadev.de (Postfix) with ESMTPA id 9A07A5F701; Thu, 7 Apr 2011 23:49:51 +0200 (CEST) From: Gerd Stolpmann To: Dawid Toton Cc: caml-list In-Reply-To: <4D9E28D2.1050808@wp.pl> References: <4D9E28D2.1050808@wp.pl> Content-Type: text/plain; charset="UTF-8" Date: Thu, 07 Apr 2011 23:49:50 +0200 Message-ID: <1302212990.8429.1150.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:wChEDxzQ75IecBULoz0JgkCW93dErwnY7TQw0G3tCVr YV8IiJc1gKEe/BiHawuFXzbtK0+krpAwb5+rND8ajbCfn1o4Np QQWzJtkU/ed8l1QS4cEE1Wz1luFVC3EG9lZq0LFRjdOKouUQa0 9TPV8Wdo+mTM7xMtJPxcYQHMY+M18W1+F91gvGJXvPlgPBiugT EZ4thH+iAdNQnYj5YEqew== Subject: Re: [Caml-list] What is an applicative functor? Am Donnerstag, den 07.04.2011, 23:12 +0200 schrieb Dawid Toton: > What does it mean that a functor is applicative? Roughly: If you apply a functor twice with the same input modules, the opaque types in the output remain compatible. For instance: module S1 = Set.Make(String) module S2 = Set.Make(String) Now, S1.t and S2.t are type-compatible, although this type is opaque. (E.g. you can do S1.empty = S2.empty.) Compare this with: module Make(X : sig end) = struct type t = Variant end module M1 = Make(struct end) module M2 = Make(struct end) Now, M1.t and M2.t are incompatible - for nominal types like variants the functors aren't applicative, and each instance is a thing of its own: # M1.Variant = M2.Variant;; Error: This expression has type M2.t but an expression was expected of type M1.t Gerd > Is there any analogy between applicative functors in OCaml and the > Applicative type class of Haskell? > Dawid > -- ------------------------------------------------------------ Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------