Questions tagged [monads]

A monad in programming is a composable computation description. Monads are an important construct in functional programming languages like Haskell.

12
votes
0answers
488 views

Binary Search Tree Monad Implementation

I've written a Binary Search Tree Monad in Scala. I would like to hear your thoughts on how to improve it (e.g. making insertion/deletion/search faster and more scalable). Also, is there a better way ...
3
votes
0answers
168 views

Sudoku solver in Haskell using Reader+ST

While trying to understand monad transformers in Haskell I came up with a sudoku solver based on a combination of the ST and Reader monad. I am positively surprised with the performance, however ...
3
votes
0answers
61 views

Abstract Key Value Store

I'm attempting to define an abstract interface for a key value store. Some requirements: Once a key has been written it should never be overwritten (although it may be deleted Transactions with ...
2
votes
0answers
48 views

Monadic implementation of asynchronous tasks (hidden overhead of threads)

So, I've been reading about monads and I wanted to see if I could implement a system for asynchronous computation in a monadic way. I came up with two solutions: The first one spawns a thread for ...
2
votes
0answers
45 views

Expressing computations on values as State

I was writing an application with a few Monads in a transformer stack. The top level application state resides in a TVar, and various components of the application ...
1
vote
0answers
518 views

Scalaz state monad exercise to model sampling of coloured balls

Here is a self imposed exercise and solution to learn Scalaz state monad. How can I refactor it to take it to the next level? So far I've only studied the state monad so would welcome suggestions on ...