Early draft spec of Strict language pragma

Hi! I started a draft spec for the Strict language pragma we chatted about during our call a while ago. I made the big mistake of writing it much after the actual discussion, so I forgot most of the details. https://ghc.haskell.org/trac/ghc/wiki/StrictPragma Perhaps if you could ask questions that you don't think are answered in the wiki page I can start fleshing it out more? P.S. I've included our chat log at the bottom of the wiki page. -- Johan

* Johan Tibell
Hi!
I started a draft spec for the Strict language pragma we chatted about during our call a while ago. I made the big mistake of writing it much after the actual discussion, so I forgot most of the details.
https://ghc.haskell.org/trac/ghc/wiki/StrictPragma
Perhaps if you could ask questions that you don't think are answered in the wiki page I can start fleshing it out more?
P.S. I've included our chat log at the bottom of the wiki page.
Will case with an irrefutable pattern force the scrutinee, too? I.e. will case x of { pat -> y } desugar to case x of { pat -> x `seq` y } ? That'd be consistent with the rules for newtypes (which I find a bit strange), so I want to clarify. Will tuples be considered to have strict fields? Since they are defined "externally" (by analogy with the Just example), they shouldn't, right? Roman

On Thu, Jul 24, 2014 at 11:10 AM, Roman Cheplyaka
Will case with an irrefutable pattern force the scrutinee, too? I.e. will
case x of { pat -> y }
desugar to
case x of { pat -> x `seq` y }
?
Yes. The user has to write ~x if he/she doesn't want that.
Will tuples be considered to have strict fields? Since they are defined "externally" (by analogy with the Just example), they shouldn't, right?
They will have lazy fields. I think we consider them as already defined in some other module (even though they are slightly magical in practice). -- Johan

OK I have made extensive edits to https://ghc.haskell.org/trac/ghc/wiki/StrictPragma You might want to check it through. Simon

Thanks a lot Simon.
Re top-level bindings:
I agree. There's no good time to force CAFs so they'll need to be
forced on first use.
Re newtypes:
I agree. Pattern matching on newtypes should be strict.
Implementation:
Where do I get started? I think we looked at some code together during
the call, but I forgot what it was? Any good identifiers to grep for?
On Fri, Jul 25, 2014 at 11:03 AM, Simon Peyton Jones
OK I have made extensive edits to https://ghc.haskell.org/trac/ghc/wiki/StrictPragma
You might want to check it through.
Simon

I suggest starting with the proposed improvements to
let !pat = rhs
* Remove the stuff in TcBinds that forces such things to be non-recursive and monomorphic -- ie bangs no longer affect type checking.
* In DsBinds, add the appropriate seqs. Take a look at DsExpr.ds_val_bind and see how you get on
Simon
| -----Original Message-----
| From: Johan Tibell [mailto:johan.tibell@gmail.com]
| Sent: 25 July 2014 12:49
| To: Simon Peyton Jones
| Cc: ghc-devs@haskell.org; Duncan Coutts
| Subject: Re: Early draft spec of Strict language pragma
|
| Thanks a lot Simon.
|
| Re top-level bindings:
|
| I agree. There's no good time to force CAFs so they'll need to be
| forced on first use.
|
| Re newtypes:
|
| I agree. Pattern matching on newtypes should be strict.
|
| Implementation:
|
| Where do I get started? I think we looked at some code together during
| the call, but I forgot what it was? Any good identifiers to grep for?
|
| On Fri, Jul 25, 2014 at 11:03 AM, Simon Peyton Jones
|
participants (3)
-
Johan Tibell
-
Roman Cheplyaka
-
Simon Peyton Jones