Large-scale design in Haskell? [closed]

I talk a bit about this in Engineering Large Projects in Haskell and in the Design and Implementation of XMonad. Engineering in the large is about managing complexity. The primary code structuring mechanisms in Haskell for managing complexity are: The type system Use the type system to enforce abstractions, simplifying interactions. Enforce key invariants via … Read more

How can a time function exist in functional programming?

Yes and no. Different functional programming languages solve them differently. In Haskell (a very pure one) all this stuff has to happen in something called the I/O Monad – see here. You can think of it as getting another input (and output) into your function (the world-state) or easier as a place where “impureness” like … Read more

Functional programming vs Object Oriented programming [closed]

When do you choose functional programming over object oriented? When you anticipate a different kind of software evolution: Object-oriented languages are good when you have a fixed set of operations on things, and as your code evolves, you primarily add new things. This can be accomplished by adding new classes which implement existing methods, and … Read more

Monad in plain English? (For the OOP programmer with no FP background)

UPDATE: This question was the subject of an immensely long blog series, which you can read at Monads — thanks for the great question! In terms that an OOP programmer would understand (without any functional programming background), what is a monad? A monad is an “amplifier” of types that obeys certain rules and which has … Read more

What part of Hindley-Milner do you not understand?

The horizontal bar means that “[above] implies [below]”. If there are multiple expressions in [above], then consider them anded together; all of the [above] must be true in order to guarantee the [below]. : means has type ∈ means is in. (Likewise ∉ means “is not in”.) Γ is usually used to refer to an … Read more

What is the difference between a ‘closure’ and a ‘lambda’?

A lambda is just an anonymous function – a function defined with no name. In some languages, such as Scheme, they are equivalent to named functions. In fact, the function definition is re-written as binding a lambda to a variable internally. In other languages, like Python, there are some (rather needless) distinctions between them, but … Read more

Does functional programming replace GoF design patterns?

The blog post you quoted overstates its claim a bit. FP doesn’t eliminate the need for design patterns. The term “design patterns” just isn’t widely used to describe the same thing in FP languages. But they exist. Functional languages have plenty of best practice rules of the form “when you encounter problem X, use code … Read more