[Haskell-cafe] Surprising interaction between @-patterns and nested patterns

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Thu Jan 5 11:17:43 UTC 2023


On Tue, Jan 03, 2023 at 08:22:08AM +0100, Henning Thielemann wrote:
> On Mon, 2 Jan 2023, David Feuer wrote:
> 
> > My opinion, for several years, has been that the Haskell designers erred in making outermost patterns
> > lazy by default in let and where, and at the top level. I believe they should have gone with
> > something much simpler:
> > 1. Patterns are strict by default.
> > 2. Variables are lazy by default.
> > 3. Patterns at the top level must be marked lazy.
> > 4. (With bang patterns) Variables at the top level may not be marked strict.
> > 
> > That would harmonize the way patterns are handled in let and where with the way they're handled in
> > function arguments and case expressions, as well as removing the outermost-pattern special case which
> > makes the *strictness* of inner patterns surprising.
> 
> me too

I am inclined to agree.  But are there any nasty corner cases
involving recursive bindings?

> > Unfortunately, I don't think there's much chance of any of these
> > changing in Haskell.
> 
> Could start as a nice GHC extension like Strict Haskell.

I agree, but an easier sell if there aren't nasty corner cases.

Tom


More information about the Haskell-Cafe mailing list