[Haskell-cafe] What is your favourite Haskell "aha" moment?

Conal Elliott conal at conal.net
Thu Jul 12 04:28:46 UTC 2018


Concurrency *can* be defined in Haskell proper (the denotative subset), but
not compatibly with that "source code" and probably not at all with the
current particulars of IO. With the source code in question, even the "real
world" cannot evolve concurrently with program execution, let alone
different threads with an IO computation.

On Wed, Jul 11, 2018 at 7:03 PM, Brandon Allbery <allbery.b at gmail.com>
wrote:

> In the presence of concurrency, IO requires runtime support and can't be
> simply defined in Haskell proper.
>
> On Wed, Jul 11, 2018 at 9:59 PM Vanessa McHale <vanessa.mchale at iohk.io>
> wrote:
>
>> I'm not sure I follow. Do you mean that IO is not a monad because
>> equivalence of values cannot be defined? Or is it something deeper?
>> On 07/11/2018 05:19 PM, Conal Elliott wrote:
>>
>> > The fact that you can define the IO monad in Haskell was quite a
>> revelation.
>>
>> But it's *not* a fact. It's a lie. And one of the most devious sort,
>> since the source code appears to agree. The purported definition couldn't
>> possibly explain concurrency.
>>
>> On Wed, Jul 11, 2018 at 7:21 AM, Vanessa McHale <vanessa.mchale at iohk.io>
>> wrote:
>>
>>> I find it quite elegant! The fact that you can define the IO monad in
>>> Haskell was quite a revelation. And it's especially nice when paired with a
>>> demonstration of C FFI (where you might *need* to sequence side effects
>>> such as freeing a value after it has been read).
>>>
>>> newtype IO <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Types.html#IO> a <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Types.html#local-6989586621679009802> = IO <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Types.html#IO> (State# <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Prim.html#State%23> RealWorld <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Prim.html#RealWorld> -> (# State# <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Prim.html#State%23> RealWorld <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Prim.html#RealWorld>, a <http://hackage.haskell.org/package/ghc-prim-0.5.2.0/docs/src/GHC.Types.html#local-6989586621679009802> #))
>>>
>>>
>>> On 07/11/2018 09:14 AM, Stefan Monnier wrote:
>>>
>>> In a few weeks I'm giving a talk to a bunch of genomics folk at the Sanger
>>> Institute<https://www.sanger.ac.uk/> <https://www.sanger.ac.uk/> about Haskell.   They do lots of
>>> programming, but they aren't computer scientists.
>>> I can tell them plenty about Haskell, but I'm ill-equipped to answer the
>>> main question in their minds: why should I even care about Haskell?  I'm too
>>> much of a biased witness.
>>>
>>> I don't much like the monad solution for side-effects, but if those guys
>>> might have some knowledge of the horror of concurrent programming with
>>> locks, the STM system would be a good candidate.
>>>
>>>
>>>         Stefan
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>>>
>>>
>>> --
>>>
>>>
>>>
>>> *Vanessa McHale*
>>> Functional Compiler Engineer | Chicago, IL
>>>
>>> Website: www.iohk.io <http://iohk.io>
>>> Twitter: @vamchale
>>> PGP Key ID: 4209B7B5
>>>
>>> [image: Input Output] <http://iohk.io>
>>>
>>> [image: Twitter] <https://twitter.com/InputOutputHK> [image: Github]
>>> <https://github.com/input-output-hk> [image: LinkedIn]
>>> <https://www.linkedin.com/company/input-output-global>
>>>
>>>
>>> This e-mail and any file transmitted with it are confidential and
>>> intended solely for the use of the recipient(s) to whom it is addressed.
>>> Dissemination, distribution, and/or copying of the transmission by anyone
>>> other than the intended recipient(s) is prohibited. If you have received
>>> this transmission in error please notify IOHK immediately and delete it
>>> from your system. E-mail transmissions cannot be guaranteed to be secure or
>>> error free. We do not accept liability for any loss, damage, or error
>>> arising from this transmission
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
>
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180711/5697fd6f/attachment.html>


More information about the Haskell-Cafe mailing list