Monad Transformers Step by Step Information Martin Grabmüller: Monad Transformers Step by Step, draft paper, October 2006. 12 pages, A4 format, English. Abstract In this tutorial, we describe how to use monad transformers in order to incrementally add functionality to Haskell programs. It is not a paper about implementing transformers, but about using them to write elegant, clean and powerful programs in Haskell. Download This article is available electronically: [ PDF ] The source code of this article, in the form of a Literate Haskell script, is also available: [ Transformers.lhs ] BibTeX Entry @Unpublished{Grabmueller2006MonadTransformers, author = {Martin Grabm{\"u}ller}, title = {{Monad Transformers Step by Step}}, note = {Draft paper}, month = {October}, year = 2006, abstract = {In this tutorial, we describe how to use monad transformers in order to incrementally add functionality to Haskell programs.
Haskell for all sol/doctest-haskell You Could Have Invented Monads! (And Maybe You Already Have.) If you hadn't guessed, this is about monads as they appear in pure functional programming languages like Haskell. They are closely related to the monads of category theory, but are not exactly the same because Haskell doesn't enforce the identities satisfied by categorical monads. Writing introductions to monads seems to have developed into an industry. There's a gentle Introduction, a Haskell Programmer's introduction with the advice "Don't Panic", an introduction for the "Working Haskell Programmer" and countless others that introduce monads as everything from a type of functor to a type of space suit. But all of these introduce monads as something esoteric in need of explanation. But what I want to argue is that they aren't esoteric at all. Many of the problems that monads try to solve are related to the issue of side effects. Side Effects: Debugging Pure Functions In an imperative programming language such as C++, functions behave nothing like the functions of mathematics. Solution and
Gentle introduction to Haskell This is the master HTML version of the Gentle Introduction To Haskell, version 98. Revised June, 2000 by Reuben Thomas. You may download the following: Brief Table of Contents. All code in this tutorial, with additional commentary, is found in the code directory packaged with this tutorial. Premission is granted to correct, improve, or enhance this document. Copyright (C) 1999 Paul Hudak, John Peterson and Joseph Fasel Permission is hereby granted, free of charge, to any person obtaining a copy of "A Gentle Introduction to Haskell" (the Text), to deal in the Text without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Text, and to permit persons to whom the Text is furnished to do so, subject to the following condition: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Text.
Haskell for all: Introductions to advanced Haskell topics Many people bemoan the sharp divide between experts and beginning Haskell programmers. One thing I've noticed is that "advanced" Haskell topics all have one thing in common: there exists only one good tutorial on that topic and only the experts have found it. This post is a collection of links to what I consider to be the definitive tutorials on these topics. Monads Monads are technically not an advanced Haskell topic, but I include this topic in the list because the vast majority of monad tutorials are terrible and/or misleading. Monad Transformers One thing that perpetually boggles me is that the blogosphere has almost no posts explaining how to use monad transformers. Parsing Outsiders comment that monads only exist to paper over Haskell's weaknesses until they discover monadic parsers. You also want to understand parser combinators for another reason: Haskell parser combinator libraries are light-years ahead of Haskell regular expression libraries. Free Monads Coroutines Lenses Conclusion
Raincat | 2D Puzzle Game 2D puzzle game featuring a fuzzy little cat "Watching the cat walk is so soothing." "He's so cute! Look at him go... go Raincat, go!" Download to play Raincat! Written in Haskell Get the Source! what fans have said "Raincat is amazing. how the cat sauntering in the rain came to be The project proved to be an excellent learning experience for the programmers. It's always raining in Pittsburgh, which makes for gray days while cats are just adorable—perfect for brightening up such days. Your goal is simple: guide the fuzzy cat safe and dry to the end of each level. Become our fan on Facebook! As students who make games for fun, we understand that our product isn't perfect. Finally, we'd like to mention that Project Raincat placed first in GCS Gold during the following spring semester release party. made by people who like cats maybe a little too much Team on the GCS Project Page for your kitty watching pleasure Thanks for visiting Project Raincat!
Haskell's evaluation isn't magic One common complaint with lazy functional programming is that reasoning about the performance of your code is harder than in a strict language. Will an expression be repeatedly evaluated or a closure repeatedly accessed? Will code use up more or less heap space? For that matter, many people have no clue as to how lazy evaluation works in the first place. This blog post show that execution in a lazy language is both understandable and predictable. Haskell is in essence a heavily sugared and extended version of a typed λ-calculus (i.e. λ-calculus with a type system attached). In 1993 Launchbury wrote A Natural Semantics for Lazy Evaluation [pdf], which provided a simple operational semantics (I’ll explain what that is in a second) for understanding the lazy evaluation of an extended λ-calculus. Before we continue, let’s remind ourselves how the λ-calculus is evaluated. What does sharing mean? Before you can apply the reduction rules, Launchbury’s semantics require a term to be normalized.
Haskell for Kids Last time, I described my work on a web-based programming environment for Haskell and Gloss, which is available from github as the gloss-web project. Now you can try it online without having to install it yourself! Here’s the URL: It seems to work fine at least with Chrome, Firefox, and Safari on Linux and Windows. What’s New I’ve made a few changes to the code and fixed a number of bugs from Sunday’s late-night coding sprint, but the biggest change was to enable use of the SafeHaskell extension. Note that there are still no resource or CPU time limits, so there are no protections against writing infinite loops or infinite data structures, so it’s still possible to use the server to run a denial of service attack against itself. Want a non-trivial example to try it with? Edit: Here’s something a little less trivial: a recursive drawing of a Koch snowflake. Thoughts on SafeHaskell Overall, I’m thrilled to have the SafeHaskell stuff in GHC. Like this:
haskell for kids haskell for kids: stepping through algebraic formulas, even if aren't about numbers Program: (overlay/xy (overlay/xy (scale 10 (star 5 'solid 'blue)) -100 100 (scale 10 (star 5 'solid 'red))) -100 200 (scale 10 (star 5 'solid 'yellow))) Images from the stepper: Understanding Algebras What is algebra? Naively speaking algebra gives us the ability to perform calculations with numbers and symbols. Abstract algebra treats symbols as elements of a vector space: they can be multiplied by scalars and added to each other. But nothing prepares you for this definition of F-algebra from the Haskell package Control.Functor.Algebra: type Algebra f a = f a -> a Close In this post I will try to bridge the gap between traditional algebras and more powerful F-algebras. The Essence of Algebra There are two really essential aspects of an algebra: The ability to form expressions andThe ability to evaluate these expressions The Essence of Expression The standard way of generating expressions is to use grammars. data Expr = Const Int | Add Expr Expr | Mul Expr Expr Like most non-trivial grammars, this one is defined recursively. But recursion can be abstracted away to uncover the real primitives behind expressions. ExprF a = Const Int | Add a a | Mul a a newtype Fix f = Fx (f (Fix f)) F-Algebras foldr