haskell,functional-programming,monads,do-notation

Well, you've stumbled upon a kind of weird monad. The monad in question is the Monad ((->) r). Now, what does that mean? Well, it's the monad of functions of the form r -> *. I.e., of functions that take the same type of input. You asked what the type...

What it says is that the order of statements doesn't influence the evaluation criteria. As @chi points out in IO monad effects are sequenced in order but their evaluation order is still not known. An example of a monad which will make the concept clear: test = do x <-...

You can wrap the remaining commands in a new do playRandomly board = do let vMoves = getValidMoves board board if vMoves == [] then return [] else do rMove <- uniform vMoves let Just nBoard = runMove board rMove rest <- playRandomly nBoard return (rMove : rest) I want...