[Haskell-cafe] Applicative but not Monad

David Menendez dave at zednenem.com
Sun Nov 1 17:23:54 EST 2009


On Sun, Nov 1, 2009 at 11:20 AM, Conor McBride
<conor at strictlypositive.org> wrote:
> On 31 Oct 2009, at 10:39, Conor McBride wrote:
>> On 30 Oct 2009, at 16:14, Yusaku Hashimoto wrote:
>>
>>> Hello cafe,
>>> Do you know any data-type which is Applicative but not Monad?
>>
>> [can resist anything but temptation]
>>
>> I have an example, perhaps not a datatype:
>> tomorrow-you-will-know
>
> Elaborating, one day later,
>
>  if you know something today, you can arrange to know it tomorrow
>  if will know a function tomorrow and its argument tomorrow, you
>    can apply them tomorrow
>  but if you will know tomorrow that you will know something the
>    day after, that does not tell you how to know the thing tomorrow
>
> Put otherwise, unit-delay is applicative but not monadic. I've been
> using this to organise exactly what happens when in those wacky
> miraculous-looking circular programs. It seems quite promising,
> so far...

Can you do that with just applicative functors, or do you need arrows?

According to "Idioms are oblivious, arrows are meticulous, monads are
promiscuous"[1], an arrow (~>) that's equivalent to an applicative
functor has the property that "a ~> b" is isomorphic to "() ~> (a ->
b)".

A typical delay arrow has the form delay :: a -> (a ~> a), so if (~>)
is equivalent to some applicative functor f, we can rewrite that as
delay :: a -> f (a -> a), which seems too limited to have the proper
behavior.


[1] http://homepages.inf.ed.ac.uk/wadler/topics/links.html#arrows-and-idioms

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list