News for hackers. Stuff that matters.
Re:What I Wish I Knew When Learning Haskell by runaway on Saturday April 11, 2020 @02:21PM (#22843166)
I thought that was the point of the section- that you may be able to tell something is wrong with the example, but the compiler can't. Thus by programming in that fashion you're not taking advantage of the power of the compiler.

The improved way below where the Just a is unwrapped with a case allows the compiler to see whether or not x is valid.

Re:What I Wish I Knew When Learning Haskell by anaphor on Saturday April 11, 2020 @02:23PM (#22843182)
Ah ok, that wasn't really clear to me, but that makes way more sense. Clearly I hadn't had any coffee when I read it earlier.
Re:What I Wish I Knew When Learning Haskell by lonelappde on Saturday April 11, 2020 @02:37PM (#22843261)
That's what these parts were going for:

> Is there anything wrong with the definitions and below

> and why is this not caught in the type system?

And

> ???

on the line you flagged as a bug.