<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>I agree that this seems to be a bug. I have a lot to do currently, but might be able to look at it sometime during next week.</div>
<div> </div>
<div id="sig22230037"><div class="signature">Adam Sandberg Eriksson<br></div>
</div>
<div> </div>
<div> </div>
<div>On Thu, 10 Dec 2015, at 03:34 PM, Johan Tibell wrote:<br></div>
<blockquote type="cite"><div dir="ltr">I believe this is just a bug, since the desugaring ought to be strict in the \x.<br></div>
<div><div> </div>
<div><div>On Tue, Dec 8, 2015 at 6:35 PM, Ömer Sinan Ağacan <span dir="ltr"><<a href="mailto:omeragacan@gmail.com">omeragacan@gmail.com</a>></span> wrote:<br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex;"><div>I think this is a problem/bug in the implementation. In the "function<br></div>
<div>
definitions" section of the wiki page it says the argument will have a<br></div>
<div>
bang pattern. But then this code:<br></div>
<div> </div>
<div>
    do x <- ...<br></div>
<div>
       return (x + 1)<br></div>
<div> </div>
<div>
which is just a syntactic sugar for `... >>= \x -> return (x + 1)`<br></div>
<div>
doesn't have the bang pattern in `x`.<br></div>
<div> </div>
<div>
(See also a related email I sent to ghc-devs yesterday:<br></div>
<div> <a href="https://mail.haskell.org/pipermail/ghc-devs/2015-December/010699.html">https://mail.haskell.org/pipermail/ghc-devs/2015-December/010699.html</a>)<br></div>
<div><div><div> </div>
<div>
2015-12-08 12:27 GMT-05:00 David Kraeutmann <<a href="mailto:kane@kane.cx">kane@kane.cx</a>>:<br></div>
<div>
> While there's a fundamental difference between (>>=) and let-bindings, it<br></div>
<div>
> might be worth adding to the docs that -XStrict only makes let bindings<br></div>
<div>
> strict.<br></div>
<div>
><br></div>
<div>
><br></div>
<div>
> On 12/08/2015 06:22 PM, Rob Stewart wrote:<br></div>
<div>
><br></div>
<div>
> Are the following two programs equivalent with respect to the strictness<br></div>
<div>
> of `readFile`?<br></div>
<div>
><br></div>
<div>
> --8<---------------cut here---------------start------------->8---<br></div>
<div>
> {-# LANGUAGE BangPatterns #-}<br></div>
<div>
><br></div>
<div>
> module Main where<br></div>
<div>
><br></div>
<div>
> main = do<br></div>
<div>
>   !contents <- readFile "foo.txt"<br></div>
<div>
>   print contents<br></div>
<div>
> --8<---------------cut here---------------end--------------->8---<br></div>
<div>
><br></div>
<div>
> And:<br></div>
<div>
><br></div>
<div>
> --8<---------------cut here---------------start------------->8---<br></div>
<div>
> {-# LANGAUGE Strict #-}<br></div>
<div>
><br></div>
<div>
> module Main where<br></div>
<div>
><br></div>
<div>
> main = do<br></div>
<div>
>   contents <- readFile "foo.txt"<br></div>
<div>
>   print contents<br></div>
<div>
> --8<---------------cut here---------------end--------------->8---<br></div>
<div>
><br></div>
<div>
> The documentation on "Strict-by-default pattern bindings" gives<br></div>
<div>
> let/where binding as an example, but there is not a monadic bind example.<br></div>
<div>
> <a href="http://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#strict-by-default-pattern-bindings">http://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#strict-by-default-pattern-bindings</a><br></div>
<div>
><br></div>
<div>
> Inspecting GHC Core for these two programs suggests that<br></div>
<div>
><br></div>
<div>
> !contents <- readFile "foo.txt"<br></div>
<div>
><br></div>
<div>
> is not equivalent to (with Strict enabled):<br></div>
<div>
><br></div>
<div>
> contents <- readFile "foo.txt"<br></div>
<div>
><br></div>
<div>
> Here's core using BangPatterns:<br></div>
<div>
><br></div>
<div>
> (readFile (unpackCString# "foo.txt"#))<br></div>
<div>
> (\ (contents_asg :: String) -><br></div>
<div>
>    case contents_asg of contents1_Xsk { __DEFAULT -><br></div>
<div>
>    print @ String $dShow_rYy contents1_Xsk<br></div>
<div>
>    })<br></div>
<div>
><br></div>
<div>
> Here's core using Strict:<br></div>
<div>
><br></div>
<div>
> (readFile (unpackCString# "foo.txt"#))<br></div>
<div>
> (\ (contents_asg :: String) -><br></div>
<div>
>    print @ String $dShow_rYv contents_asg)<br></div>
<div>
><br></div>
<div>
> Does this core align with the design of the Strict extension?<br></div>
<div>
><br></div>
<div>
> If it does, are users going to understand that using Strict is going to<br></div>
<div>
> make let/where bindings strict, but is not going to make <- or >>=<br></div>
<div>
> bindings strict?<br></div>
<div>
><br></div>
<div>
> --<br></div>
<div>
> Rob Stewart<br></div>
<div>
><br></div>
<div>
><br></div>
<div>
> _______________________________________________<br></div>
<div>
> ghc-devs mailing list<br></div>
<div>
> <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br></div>
<div>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></div>
<div>
><br></div>
<div>
><br></div>
<div>
><br></div>
<div>
> _______________________________________________<br></div>
<div>
> ghc-devs mailing list<br></div>
<div>
> <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br></div>
<div>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></div>
<div>
><br></div>
<div>
_______________________________________________<br></div>
<div>
ghc-devs mailing list<br></div>
<div> <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br></div>
<div> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></div>
</div>
</div>
</blockquote></div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>ghc-devs mailing list<br></div>
<div><a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br></div>
<div><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br></div>
</blockquote><div> </div>
</body>
</html>