## Lazy is Good

Laziness is a key feature of the Haskell programming language. The main idea is that we only evaluate expressions when they are actually needed. Unlike Haskell, most programming languages implement …

## Infinite Data Structures

In the previous video, we looked at infinite lists. We can define an infinite list of consecutive integers as follows: [1..] We can evaluate this list, but it won’t print …

## Type Inference by Example

Type inference is the process by which Haskell ‘guesses’ the types for variables and functions, without you needing to specify these types explicitly. Many functional languages feature type inference. There …

## Summary

Function types describe the types of arguments and return value of a function. The type of an argument can be a type variable, in which case we call the function …

## Haskell Guide: Types, Lambda Functions and Type Classes

Function types Ordinary data types are for primitive data (like (Int) and (Char)) and basic data structures (like ([Int]) and ([Char])). Algebraic data types are types that combine other types …

## Curry is on the menu

Partial Application and Currying Currying Consider a type signature of a function with three arguments: f :: X -> Y -> Z -> A The arrow “->” is right-associative, so …

## Talk with a Haskell Teacher

Professor Graham Hutton from Nottingham University recently visited us at Glasgow. In fact, Graham got his PhD at Glasgow — many years ago. He runs a Functional Programming research lab …

## Using QuickCheck

Now let’s have a go at using QuickCheck for ourselves. We presume you have already watched the video about QuickCheck in the previous step. We’ll run this session in GHCi …

## Check my Program is Correct

QuickCheck is a useful tool for automatically generating test cases for your Haskell programs. It’s widely used in industrial settings. In this video, Jeremy is checking his Caesar’s Cipher implementation. …

## Guards, Guards!

Haskell provides a notation for defining functions based on predicate values. f x | predicate1 = expression1 | predicate2 = expression2 | predicate3 = expression3 For instance, the absolute value …

## Dealing with Uncertainty

What do we do when computations fail to generate results? Examples include taking the head of an empty list, or finding the minimum value of a tree which turns out …

## Summary

Parsing text is a very common and important operation. Monadic parser combinators are a convenient mechanism to build parsers by combining building blocks, and a good illustration of the practical …