Tag Archives: monad

MonadRandom 0.5 released

I’m happy to announce the release of MonadRandom-0.5, a package which provides a convenient monadic interface for random number generation in the style of transformers and mtl: a Rand monad (essentially a state monad that threads through a generator), a … Continue reading

Posted in haskell, projects | Tagged , , | Leave a comment

MonadRandom 0.5 and mwc-random: feedback wanted

Since 2013 or so I have been the maintainer of the MonadRandom package, which provides an mtl-style type class for monads with support for generation of pseudorandom values, along with a concrete random monad transformer RandT. As of this writing … Continue reading

Posted in haskell, projects | Tagged , | 9 Comments

Monad transformers: a cautionary tale

When writing the code in my previous post, I wanted to have a monad which combined the ability to generate random numbers with the ability to fail. Naturally, I decided to use RandT Maybe. But when I tried to write … Continue reading

Posted in haskell | Tagged , , , | Leave a comment

Teaching abstraction

I’m just beginning to prepare for the third incarnation of CIS 194, Introduction to Haskell in the spring. It’s occasioned some general thoughts on teaching abstraction which seemed worth writing down. Abstractions, of course, are everywhere in CS. By abstraction … Continue reading

Posted in teaching | Tagged , , , | 8 Comments

Parsing context-sensitive languages with Applicative

Many parser combinator libraries in Haskell (such as parsec) have both a Monad interface as well as an Applicative interface. (Actually, to be really useful, you also need MonadPlus along with Monad, or Alternative along with Applicative, in order to … Continue reading

Posted in haskell | Tagged , , , , , , | 11 Comments


Posted in haskell, humor | Tagged , , , , | 4 Comments

Themes on Streams

> {-# LANGUAGE DeriveFunctor, FlexibleInstances #-} Recall that a stream is a countably infinite sequence of values: > data Stream a = a :> Stream a > deriving (Functor, Show) > > sHead (a :> _) = a > sTail … Continue reading

Posted in haskell, math | Tagged , , , , , | 3 Comments