background preloader

Learn Haskell Fast and Hard

Learn Haskell Fast and Hard
I really believe all developers should learn Haskell. I don’t think everyone needs to be super Haskell ninjas, but they should at least discover what Haskell has to offer. Learning Haskell opens your mind. Mainstream languages share the same foundations: variablesloopspointersdata structures, objects and classes (for most) Haskell is very different. But learning Haskell can be hard. This article will certainly be hard to follow. The conventional method to learning Haskell is to read two books. In contrast, this article is a very brief and dense overview of all major aspects of Haskell. The article contains five parts: Introduction: a short example to show Haskell can be friendly.Basic Haskell: Haskell syntax, and some essential notions.Hard Difficulty Part: Functional style; a progressive example, from imperative to functional styleTypes; types and a standard binary tree exampleInfinite Structure; manipulate an infinite binary tree! 01_basic/10_Introduction/00_hello_world.lhs Introduction ou

A Gentle Introduction to Haskell, Version 98 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.

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. 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. Copyright (C) 2003-2008 Martin Grabmüller Verbatim copying and distribution of this entire web page is permitted in any medium, provided this notice is preserved.

Haskell: The Confusing Parts If you’re used to the C family of languages, or the closely related family of “scripting languages,” Haskell’s syntax (mainly) is a bit baffling at first. For some people, it can even seem like it’s sneaking out from under you every time you think you understand it. This is sort of a FAQ for people who are new to Haskell, or scared away by its syntax. Use this as a cheat sheet, not a textbook. Misc. Quick review, because if you’ve heard of Haskell, you should also have heard of most of this. foo :: Bar baz -> Bar quux is a type signature for the function foo, where Bar baz is the type of argument it takes, and Bar quux is the type of the return value. There’s no null and no void. Haskell’s syntax is indirectly based on ML, so if you stop reading here and go learn OCaml instead, some of this information will still be kinda useful. Type Names and Constructors There are two completely separate namespaces in any Haskell source file: The value namespace, and the type namespace. Statements vs.

sol/doctest-haskell 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.

Raincat | 2D Puzzle Game 2D puzzle game featuring a fuzzy little cat "Watching the cat walk is so soothing." "He's so cute! 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. Internet Explorer (even 9) is known NOT to work. 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 Anyway, that’s it for now!

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 what makes algebras stand appart from linear spaces is the presence of vector multiplication: a bilinear product of vectors whose result is another vector (as opposed to inner product, which produces a scalar). Complex numbers, for instance, can be described as 2-d vectors, whose components are the real and the imaginary parts. 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 | Add Expr Expr

Related: