<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Wow, that's pretty unexpected. Another repro case:</div><div><br></div><div>p = pure</div><div><br></div><div>bar :: Applicative f => f a</div><div>bar = do</div><div> x <- pure "ok"</div><div> p x</div><div><br></div><div>... gives the same error. So ApplicativeDo statements *must* end with exactly the statement "pure"?</div><div><br></div><div><br>El 16 jun 2016, a las 12:39, Joe Quinn <<a href="mailto:headprogrammingczar@gmail.com">headprogrammingczar@gmail.com</a>> escribió:<br><br></div><blockquote type="cite"><div>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
<div class="moz-cite-prefix">I expect it's that the root of the
expression on the last line is ($) and not pure. ApplicativeDo has
restrictions on what you can do to avoid allowing blocks that have
to translate in terms of join/(>>=), and likely one of them
is that the last line can't be an arbitrary thing of the right
type.<br>
<br>
On 6/16/2016 12:30 PM, <a class="moz-txt-link-abbreviated" href="mailto:amindfv@gmail.com">amindfv@gmail.com</a> wrote:<br>
</div>
<blockquote cite="mid:5AC319DA-F5D6-45C8-A3B6-C617B5768F70@gmail.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<div>They're the same:</div>
<div><br>
</div>
<div>> :t \x -> pure x</div>
<div><span style="background-color: rgba(255, 255, 255, 0);"> \x
-> pure x :: Applicative f => a -> f a</span></div>
<div>
<div><span style="background-color: rgba(255, 255, 255, 0);">>
:t \x -> pure $ x</span></div>
<div><span style="background-color: rgba(255, 255, 255, 0);"> \x
-> pure $ x :: Applicative f => a -> f a</span></div>
</div>
<div><span style="background-color: rgba(255, 255, 255, 0);"><br>
</span></div>
<div><span style="background-color: rgba(255, 255, 255, 0);">Tom</span></div>
<div><span style="background-color: rgba(255, 255, 255, 0);"><br>
</span></div>
<div><br>
El 16 jun 2016, a las 12:24, KC <<a moz-do-not-send="true" href="mailto:kc1956@gmail.com">kc1956@gmail.com</a>>
escribió:<br>
<br>
</div>
<blockquote type="cite">
<div>
<p dir="ltr">Think of the types of</p>
<p dir="ltr">pure x</p>
<p dir="ltr">And</p>
<p dir="ltr">pure $ x</p>
<p dir="ltr">--<br>
--</p>
<p dir="ltr">Sent from an expensive device which will be
obsolete in a few months! :D</p>
<p dir="ltr">Casey<br>
</p>
<div class="gmail_quote">On Jun 16, 2016 9:06 AM, <<a moz-do-not-send="true" href="mailto:amindfv@gmail.com"></a><a class="moz-txt-link-abbreviated" href="mailto:amindfv@gmail.com">amindfv@gmail.com</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">foo ::
Applicative f => f String<br>
foo = do<br>
x <- pure "this works"<br>
pure x<br>
<br>
... but replace "pure x" with "pure $ x" and it doesn't
typecheck: a monad instance is required!<br>
<br>
Tom<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a moz-do-not-send="true" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a moz-do-not-send="true" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote>
</div>
</div>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Haskell-Cafe mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
</pre>
</blockquote>
<p><br>
</p>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br></div></blockquote></body></html>