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 91BEE7F61E for ; Sat, 4 Nov 2017 18:52:54 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=philippe.veber@gmail.com; spf=Pass smtp.mailfrom=philippe.veber@gmail.com; spf=None smtp.helo=postmaster@mail-ot0-f175.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of philippe.veber@gmail.com) identity=pra; client-ip=74.125.82.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="philippe.veber@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of philippe.veber@gmail.com designates 74.125.82.175 as permitted sender) identity=mailfrom; client-ip=74.125.82.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="philippe.veber@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-ot0-f175.google.com) identity=helo; client-ip=74.125.82.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="philippe.veber@gmail.com"; x-sender="postmaster@mail-ot0-f175.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A+RHc6hEsMvnLcdZjdYPBMJ1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ74pM6wAkXT6L1XgUPTWs2DsrQf1LqQ7viocFdDyKjCmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWapAQfERTnNAdz?= =?us-ascii?q?Ov+9WsuL15z2hKiO/Mj0ZwhHzG66Zb59BBK1qATT8M4Mjt0mYp4xyx/IumNFM9?= =?us-ascii?q?pbz25ybQaLnxf459+o8dh9/i5dodou8sdBVePxeKFuCfRTBTEie30u6dfw/U3I?= =?us-ascii?q?RA6Lo38dSXk+kxxSAgGD4gusGt+7iCrxtuNn1GGle+iwBZIzXzm5pe8/Uh7jiA?= =?us-ascii?q?8OMTg04GDezMtqg/Qf6BSgrB8524fQZIiZNfx5ZYvSeNobQSxKWcMCeTZGB9aE?= =?us-ascii?q?b4oLDvIZMK5mooPwvRNatRu/AQi0HO6p1DJCi2Xe0qgz0uBnGgbDil9zV+kSuW?= =?us-ascii?q?jZ+Y2mfJwZVvq4meyRlW3O?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CVAgAM/v1Zhq9SfUpcHQEFAQsBg1k/b?= =?us-ascii?q?icHg3aBNpgDgXwCgnuGRY8VCiOEAwGBFAKEUAdDFAEBAQEBAQEBAQESAQEBCAs?= =?us-ascii?q?LCCgvgjgFAR4BBYI9AQICASMEGQEbHgMBCwYDAgs3AgIiAREBBQEcBgESigoBA?= =?us-ascii?q?w0IEIp+kRtAjAyBbRgFARyDCgWDXAoZJw1Ygm4BAQgBAQEBAQEaAgYSgxyCB4F?= =?us-ascii?q?ThRODFgyBWUOCaIJiBaIOgjCFNo0WgnSQQIxhiSEUBR+BFTaCDTQhJV41gh8BD?= =?us-ascii?q?wmCGiofgXRANgGLEoFVAQEB?= X-IPAS-Result: =?us-ascii?q?A0CVAgAM/v1Zhq9SfUpcHQEFAQsBg1k/bicHg3aBNpgDgXw?= =?us-ascii?q?CgnuGRY8VCiOEAwGBFAKEUAdDFAEBAQEBAQEBAQESAQEBCAsLCCgvgjgFAR4BB?= =?us-ascii?q?YI9AQICASMEGQEbHgMBCwYDAgs3AgIiAREBBQEcBgESigoBAw0IEIp+kRtAjAy?= =?us-ascii?q?BbRgFARyDCgWDXAoZJw1Ygm4BAQgBAQEBAQEaAgYSgxyCB4FThRODFgyBWUOCa?= =?us-ascii?q?IJiBaIOgjCFNo0WgnSQQIxhiSEUBR+BFTaCDTQhJV41gh8BDwmCGiofgXRANgG?= =?us-ascii?q?LEoFVAQEB?= X-IronPort-AV: E=Sophos;i="5.44,343,1505772000"; d="scan'208,217";a="299304346" Received: from mail-ot0-f175.google.com ([74.125.82.175]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 04 Nov 2017 18:52:53 +0100 Received: by mail-ot0-f175.google.com with SMTP id q99so5246485ota.2 for ; Sat, 04 Nov 2017 10:52:53 -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; bh=wY7UqlYxxvxecTm4ZXMhfA46hl74lIUzzv9BYJ3373k=; b=oBq4j5GiXaHMBTQOmkZ+OIQEma0uI5I1nYJl7B8dbXRo77HQfV5zI7jvZcV3mTyPH8 +N6Q87wrCdIS41ykq1RDl29L45/V0fzXw+LV/2/hc3tPsIj8Mxe6tlcPpcMWulBKKrNW ucWpGaZr0pkU1nRfKejsd2oh0Qjv1g/F3UYQHL2WwSOGeKI9Bvqxm5VdeDSoymV2om4b p00wohfxrAKDChRLk2S8k5kXSzE8HzgnemPEpgpCuCVUjTRPMPthsOAkhJYz5L/1W9um QAlw2o+zLp9UKA0EuTp4puvS6+Ad/Hj5J7+YarnrO3XF58zbfQmXXwFg8xOfM3mR7G60 cjXw== 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; bh=wY7UqlYxxvxecTm4ZXMhfA46hl74lIUzzv9BYJ3373k=; b=hqe4T6XEtD169YKL3lKIu4fUIRWS5f9yA4DzscBZ7KXyCKGWvWybLykNVQjAyzs3P5 QDNjLFNymVQQFV/INjC8RCf7VQ6WcJHfpG5UsQ4E7aQ/E+Yl3o7wxxjth5aT4IkBxzAP mVyvkM2HakoHGKNaNh4xQzdeRW7N9BTtwmX7Bn00edyIJuBQZveIB/xB3lUxfY8dnTKo iNFRVvxmHlolvEYkefxXZjL1R3p//98u8YHUElkOH107GR712vNAF0Y/hoZ9AAFQfR3O kti1/hO4Fn5V5AIQKaG/mnrXwCDIuix3UnRmUeqXKoAgWXaG60SYd863hnVv5VeDSPLb 0ILg== X-Gm-Message-State: AJaThX6HFgwFmMscEOrznosOyCWcRxgx9kV0ySUO9XrOEuUDIEDHtcgV oYyOhGWEqwh7ezT4uphVIsopO4X/6ewfD99DoZw= X-Google-Smtp-Source: ABhQp+RqOpwbv+28evyL7aKhVECKVZijC9xH3f7NSr8Z30l9BDD5rKWNxMl8NAo7cmM8A/QtQTunxhDNF89xezog3pk= X-Received: by 10.157.74.55 with SMTP id h52mr6119641otf.6.1509817971558; Sat, 04 Nov 2017 10:52:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.34.77 with HTTP; Sat, 4 Nov 2017 10:52:30 -0700 (PDT) In-Reply-To: <20171101071609.GA1448@Magus.localnet> References: <20171101071609.GA1448@Magus.localnet> From: Philippe Veber Date: Sat, 4 Nov 2017 18:52:30 +0100 Message-ID: To: Oleg , Philippe Veber , caml users , "Richard W.M. Jones" , nick.palladinos@gmail.com Content-Type: multipart/alternative; boundary="001a114f0512decc77055d2be35e" X-Validation-by: philippe.veber@gmail.com Subject: Re: [Caml-list] What if exn was not an open type? --001a114f0512decc77055d2be35e Content-Type: text/plain; charset="UTF-8" Thanks a lot Leo and Oleg for all this very exciting material! 2017-11-01 8:16 GMT+01:00 Oleg : > > > > I thought one big selling argument of monads was also that the type of > > the functions shows which effect it performs. As I understand it, it > > is not the case for effects, at least not in existing implementations > > like multicore ocaml. ... Also, would you know a reference that shows > > that effects compose indeed a lot more easily than monads? > > How expressive are the types of effectful computations pretty much > depends on a particular type system in use. Let me cite from the message > that I received from Nick Palladinos (CCed) the other week, who implemented > extensible effects in F#, a rather close relative of OCaml. You can > write the code as below > > let example () = > eff { > do! put 1 > let! x = get () > let! y = ask () > return x + y > } > > (Here, `eff' is a tag of so-called computational expressions of F#, a > very handy feature). > > The *inferred* type is as follows > val example : unit -> Eff<'U,int> when 'U :> Reader and 'U :> > State > > clearly stating that example is an effectful expression that uses at > least Reader and State effects. The example also illustrates > composability, your second question: put/get and ask are operations of two > distinct effects (State and Reader, resp). You can combine them freely > within the same program. > > (I hope Nick will write a paper explaining his implementation so that > we can all learn from it.) > > To give more references (in addition to Leo's work), I should point to Koka > https://koka-lang.github.io/koka/doc/kokaspec.html > > which is an OCaml-like language based on effects and > effect-typing. The language is mature enough to write a web server in > it (as Daan Leijen described in his talk at the ML Family workshop > this year). > > Other references are the recent Effekt library in Scala > http://b-studios.de/scala-effekt/ > and extensible-effect library > http://okmij.org/ftp/Haskell/extensible/ > which, although being first proposed for Haskell has also been ported > to Scala (and now F#). Purescript's extensible effects are also > similar. > > > --001a114f0512decc77055d2be35e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks a lot Leo and Oleg for all this very exciting mater= ial!

201= 7-11-01 8:16 GMT+01:00 Oleg <oleg@okmij.org>:


> I thought one big selling argument of monads was also that the type of=
> the functions shows which effect it performs. As I understand it, it > is not the case for effects, at least not in existing implementations<= br>
> like multicore ocaml. ... Also, would you know a reference that= shows
> that effects compose indeed a lot more easily than mo= nads?

How expressive are the types of effectful computations pretty much depends on a particular type system in use. Let me cite from the message
that I received from Nick Palladinos (CCed) the other week, who implemented=
extensible effects in F#, a rather close relative of OCaml. You can
write the code as below

let example () =3D
=C2=A0 =C2=A0 eff {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 do! put 1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 let! x =3D get ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 let! y =3D ask ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return x + y
=C2=A0 =C2=A0 }

(Here, `eff' is a tag of so-called computational expressions of F#, a very handy feature).

The *inferred* type is as follows
=C2=A0 val example : unit -> Eff<'U,int> when 'U :> Rea= der<int> and 'U :> State<int>

clearly stating that example is an effectful expression that uses at
least Reader and State effects. The example also illustrates
composability, your second question: put/get and ask are operations of two<= br> distinct effects (State and Reader, resp). You can combine them freely
within the same program.

(I hope Nick will write a paper explaining his implementation so that
we can all learn from it.)

To give more references (in addition to Leo's work), I should point to = Koka
=C2=A0 =C2=A0 =C2=A0 =C2=A0 https://koka-lang.gith= ub.io/koka/doc/kokaspec.html

which is an OCaml-like language based on effects and
effect-typing. The language is mature enough to write a web server in
it (as Daan Leijen described in his talk at the ML Family workshop
this year).

=C2=A0 =C2=A0 =C2=A0 =C2=A0 Other references are the recent Effekt library = in Scala
=C2=A0 =C2=A0 =C2=A0 =C2=A0 http://b-studios.de/scala-effekt/<= /a>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 and extensible-effect library
=C2=A0 =C2=A0 =C2=A0 =C2=A0
http://okmij.org/ftp/Haskell/extensible/
which, although being first proposed for Haskell has also been ported
to Scala (and now F#). Purescript's extensible effects are also
similar.



--001a114f0512decc77055d2be35e--