background preloader

Vialette

Facebook Twitter

Introduction - Learn You a Haskell for Great Good! About this tutorial Welcome to Learn You a Haskell for Great Good!

Introduction - Learn You a Haskell for Great Good!

If you're reading this, chances are you want to learn Haskell. Well, you've come to the right place, but let's talk about this tutorial a bit first. I decided to write this because I wanted to solidify my own knowledge of Haskell and because I thought I could help people new to Haskell learn it from my perspective. There are quite a few tutorials on Haskell floating around on the internet. This tutorial is aimed at people who have experience in imperative programming languages (C, C++, Java, Python …) but haven't programmed in a functional language before (Haskell, ML, OCaml …).

The channel #haskell on the freenode network is a great place to ask questions if you're feeling stuck. I failed to learn Haskell approximately 2 times before finally grasping it because it all just seemed too weird to me and I didn't get it. So what's Haskell? Haskell is a purely functional programming language. Haskell is lazy. Learn You a Haskell for Great Good! Haskell. Introduction. Haskell is a computer programming language.

Introduction

In particular, it is a polymorphically statically typed, lazy, purely functional language, quite different from most other programming languages. The language is named for Haskell Brooks Curry, whose work in mathematical logic serves as a foundation for functional languages. Haskell is based on the lambda calculus, hence the lambda we use as a logo. 1 Why use Haskell? Writing large software systems that work is difficult and expensive. WOW! Even if you are not in a position to use Haskell in your programming projects, learning Haskell can make you a better programmer in any language. I learned Haskell a couple of years ago, having previously programmed in Python and (many) other languages. Haskell offers you: Substantially increased programmer productivity (Ericsson measured an improvement factor of between 9 and 25 using Erlang, a functional programming language similar to Haskell, in one set of experiments on telephony software). 3.4 Brevity.

The Marvels of Monads - Yet Another Language Geek. If the word "continuation" causes eyes to glaze over, then the word "monad" induces mental paralysis.

The Marvels of Monads - Yet Another Language Geek

Perhaps, this is why some have begun inventing more benign names for monads. These days, monads are the celebrities of programming language theory. They gloss the cover of blogs and have been compared to everything from boxes of fruit to love affairs. Nerds everywhere are exclaiming that the experience of understanding monads causes a pleasantly painful mental sensation. Like continuations, monads are simpler than they sound and are very useful in many situations. With all of the attention that monads get, why am I writing yet another explanation of monads? Introducing Monads Monads come from category theory. Monad (functional programming) Formally, a monad consists of a type constructor M and two operations, bind and return (where return is often also called unit).

Monad (functional programming)

The operations must fulfill several properties to allow the correct composition of monadic functions (i.e. functions that use values from the monad as their arguments or return value). The return operation takes a value from a plain type and puts it into a monadic container using the constructor, creating a monadic value. The bind operation performs the reverse process, extracting the original value from the container and passing it to the associated next function in the pipeline, possibly with additional checks and transformations. Because a monad can insert additional operations around a program's domain logic, monads can be considered a sort of aspect-oriented programming.[7] The domain logic can be defined by the application programmer in the pipeline, while required aside bookkeeping operations can be handled by a pre-defined monad built in advance. Chet Baker - My Funny Valentine.