Hackage: Introduction
Introduction - Learn You a Haskell for Great Good!
About this tutorial Welcome to Learn You a Haskell for Great Good! If you're reading this, chances are you want to learn Haskell. 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. 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. Haskell is statically typed. Haskell is elegant and concise. Haskell was made by some really smart guys (with PhDs). What you need to dive in A text editor and a Haskell compiler.

Home - D Programming Language
Haskell/Applicative functors
When covering the vital Functor and Monad type classes, we glossed over a third type class: Applicative, the class for applicative functors. Like monads, applicative functors are functors with extra laws and operations; in fact, Applicative is an intermediate class between Functor and Monad. Applicative are a widely used class with a wealth of applications (pardon the pun). Functor recap[edit] We will begin with a quick review of the Functor class chapter. class Functor f where fmap :: (a -> b) -> f a -> f b If a type has an instance of Functor, you can use fmap to apply a function to values in it. fmap id = id -- 1st functor lawfmap (g . f) = fmap g . fmap f -- 2nd functor law Maybe, for example, has a Functor instance, and so we can easily modify the value inside it... Prelude> fmap negate (Just 2)Just (-2) ...as long as it exists, of course. Prelude> fmap negate NothingNothing For extra convenience, fmap has an infix synonym, (<$>). Prelude> negate <$> Just 2Just (-2) The type of (<*>) is:

The Julia Language
Haskell/The Functor class
In this chapter, we will introduce the important Functor type class. Motivation[edit] In Other data structures, we saw operations that apply to all elements of some grouped value. The prime example is map which works on lists. data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving (Show) The map function we wrote for Tree was: treeMap :: (a -> b) -> Tree a -> Tree btreeMap f (Leaf x) = Leaf (f x)treeMap f (Branch left right) = Branch (treeMap f left) (treeMap f right) As discussed before, we can conceivably define a map-style function for any arbitrary data structure. When we first introduced map in Lists II, we went through the process of taking a very specific function for list elements and generalizing to show how map combines any appropriate function with all sorts of lists. Introducing Functor[edit] Functor is a Prelude class for types which can be mapped over. class Functor f where fmap :: (a -> b) -> f a -> f b The usage of the type variable f can look a little strange at first. Note

How to learn Haskell
How This Guide Works So you want learn Haskell, and somehow or another you've ended up at this page. Good! This isn't really a tutorial though. Maybe you could call it a meta-tutorial. If you have any questions or comments, the authors would love to hear from you! Starting Out Make sure you understand the reasons for learning Haskell Unlike some modern languages, Haskell is not a language you will pick up in two days and then be able to write your homework 10x faster in. Installing and running Haskell The first thing you should do is install a Haskell compiler/interpreter on your system. Resources:The Haskell Wiki has an enormous collection of tutorials, papers, and other resources for the aspiring Haskeller.Haskell in 5 Steps talks about how to get Haskell on your computer and start writing programsReal World Haskell's guide to installing and running GHC Editors & GHCI To make the most of the code examples you find, you should set up a good editor environment for yourself. a = 5 with Syntax

Haskell/Applicative functors
When covering the vital Functor and Monad type classes, we glossed over a third type class: Applicative, the class for applicative functors. Like monads, applicative functors are functors with extra laws and operations; in fact, Applicative is an intermediate class between Functor and Monad. Applicative are a widely used class with a wealth of applications (pardon the pun). It enables the eponymous applicative style, a convenient way of structuring functorial computations, and also provides means to express a number of important patterns. Functor recap[edit] We will begin with a quick review of the Functor class chapter. class Functor f where fmap :: (a -> b) -> f a -> f b If a type has an instance of Functor, you can use fmap to apply a function to values in it. fmap id = id -- 1st functor lawfmap (g . f) = fmap g . fmap f -- 2nd functor law Maybe, for example, has a Functor instance, and so we can easily modify the value inside it... Prelude> fmap negate (Just 2)Just (-2) Note Déja vu[edit]

post-rfc/sotu.md at master · Gabriel439/post-rfc
The functor design pattern
This post builds on my previous post on the category design pattern and this time I will discuss the functor design pattern. If you are an intermediate Haskell programmer and you think you already understand functors, then think again, because I promise you this post will turn most of your preconceptions about functors on their head and show you how functors are much more powerful and generally applicable than you might realize. Mixing features So let's pretend that my previous post on categories inflamed your interest in compositional programming. Fortunately, programmers solve compatibility problems like this all the time. Typically, one category will be more featureful than the other, so the transformation is unidirectional. -- This "map"s an ordinary function to a monadic function map :: (Monad m) => (a -> b) -> (a -> m b) map f = return . f ... but we cannot write the reverse function and automatically map every monadic function to an ordinary function. Perfect! -- Smarter! Functors