Abusing the algebra of algebraic data types – why does this work?

Disclaimer: A lot of this doesn’t really work quite right when you account for ⊥, so I’m going to blatantly disregard that for the sake of simplicity. A few initial points: Note that “union” is probably not the best term for A+B here–that’s specifically a disjoint union of the two types, because the two sides … Read more

Good Haskell source to read and learn from [closed]

What I recommend. Read code by people from different grad schools in the 1990s Oxford style Glasgow style or (this) Chalmers style (or this) York style Portland style or OGI style (or this) Utrecht style Yale style Special case: CMU/Elliott Read code by the old masters certain people (incomplete list) Marlow; Paterson; Peyton Jones; Gill; … Read more

Transitivity of Auto-Specialization in GHC

Short answers: The question’s key points, as I understand them, are the following: “is the auto-specialization transitive?” Should I only expect (+) to be specialized transitively with an explicit pragma? (apparently intended) Is this a bug of GHC? Is it inconsistent with the documentation? AFAIK, the answers are No, mostly yes but there are other … Read more

Why do we need monads?

Why do we need monads? We want to program only using functions. (“functional programming (FP)” after all). Then, we have a first big problem. This is a program: f(x) = 2 * x g(x,y) = x / y How can we say what is to be executed first? How can we form an ordered sequence … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)