this post was submitted on 25 Aug 2023
3 points (100.0% liked)

Haskell

5 readers
1 users here now

**The Haskell programming language community.** Daily news and info about all things Haskell related: practical stuff, theory, types, libraries, jobs, patches, releases, events and conferences and more... ### Links - Get Started with Haskell

founded 2 years ago
 

To better understand some counterintuitive evaluation puzzles, we explore the notion of “demand” as it exists in Haskell and discuss how it influences GHC’s choice of evaluation strategy.

top 2 comments
sorted by: hot top controversial new old
[–] soltech@kbin.social 2 points 2 years ago

This video series is really great!

[–] jaror@kbin.social 2 points 2 years ago* (last edited 2 years ago)

I think pseq does have that "thunk forcing" behavior:

import GHC.Conc (pseq)

val :: Int
val = let x = error "x"
          y = error "y"
      in y `pseq` (x + y)

main = print val

I believe this is guaranteed to show the y error and not the x error.