[GHC] #8347: Add a Strict LANGUAGE pragma

#8347: Add a Strict LANGUAGE pragma ------------------------------------+------------------------------------- Reporter: tibbe | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- A `Strict` `LANGUAGE` pragma would allow us to experiment with writing in a strict sub-language. Since this pragma works on a per module basis, it needs to be modular. I propose the following semantics: * Patterns are strict at the top-level, as if they had a top-level bang, unless an explicit ~ is used to make the pattern lazy. * Functions evaluate their parameters to WHNF. * Data type fields are strict (as if they had a bang-pattern). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------ Reporter: tibbe | Owner: tibbe Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by tibbe): * owner: => tibbe -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: tibbe Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.6.3 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: tibbe Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D1033 -------------------------------------+------------------------------------- Changes (by thomie): * differential: => Phab:D1033 * milestone: => 7.12.1 Comment: From https://ghc.haskell.org/trac/ghc/wiki/StrictPragma:
Haskell doesn't allow for ~ patterns in data constructor definitions today: we'll add support for such definitions and have it give the current lazy behavior.
From Phab:D1033, I understand that using `~` in data constructor definitions without `-XStrictData` will be the error: "Lazy annotation (~) without StrictData" Maybe it would be useful to be able to compile a module both with and without `-XStrictData`, to compare performance differences. In that case this new `~` syntax should be under a different language pragma. Has this been given consideration? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: tibbe Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D1033 -------------------------------------+------------------------------------- Comment (by tibbe): I would pile on even more stuff on Phab:D1033, but we could add a `-XExplicitLazyFields` language pragma that's implied by `-XStrictFields` in a separate commit. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma
-------------------------------------+-------------------------------------
Reporter: tibbe | Owner: tibbe
Type: feature request | Status: new
Priority: normal | Milestone: 7.12.1
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions: Phab:D1033
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Changes (by adamse): * owner: tibbe => adamse * differential: Phab:D1033 => Phab:D1033, Phab:D1142 Old description:
A `Strict` `LANGUAGE` pragma would allow us to experiment with writing in a strict sub-language. Since this pragma works on a per module basis, it needs to be modular. I propose the following semantics:
* Patterns are strict at the top-level, as if they had a top-level bang, unless an explicit ~ is used to make the pattern lazy. * Functions evaluate their parameters to WHNF. * Data type fields are strict (as if they had a bang-pattern).
New description: A `Strict` `LANGUAGE` pragma would allow us to experiment with writing in a strict sub-language. Since this pragma works on a per module basis, it needs to be modular. I propose the following semantics: * Patterns are strict at the top-level, as if they had a top-level bang, unless an explicit ~ is used to make the pattern lazy. * Functions evaluate their parameters to WHNF. * Data type fields are strict (as if they had a bang-pattern). Design page: StrictPragma -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Changes (by simonpj): * cc: adamse, tibbe (added) Comment: If this is committed, can we close it? However, I wish there were a few regression tests to demonstrate the feature. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Comment (by tibbe): Only the `StrictData` part is done. The more general `Strict` pragma (i.e. also dealing with bindings) is still waiting for review (https://phabricator.haskell.org/D1142). If you haven't taken a look already, please do so. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Comment (by simonpj): OK I'll do that. Still, regression tests for the `StrictData` part would be good. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Comment (by adamse): See https://ghc.haskell.org/trac/ghc/browser/ghc/testsuite/tests/deSugar/should_... for regression tests for `StrictData`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | DsStrictData Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Changes (by adamse): * testcase: => DsStrictData -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | DsStrictData Blocked By: | Blocking: Related Tickets: | Differential Revisions: | Phab:D1033, Phab:D1142 -------------------------------------+------------------------------------- Comment (by simonpj): Sorry, missed that test. Good! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8347: Add a Strict LANGUAGE pragma
-------------------------------------+-------------------------------------
Reporter: tibbe | Owner: adamse
Type: feature request | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case: DsStrictData
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1033,
| Phab:D1142
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#8347: Add a Strict LANGUAGE pragma -------------------------------------+------------------------------------- Reporter: tibbe | Owner: adamse Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: DsStrictData, | DsStrictLet, DsStrictFail, | DsStrictWarn Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1033, Wiki Page: | Phab:D1142 -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * testcase: DsStrictData => DsStrictData, DsStrictLet, DsStrictFail, DsStrictWarn * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8347#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC