st-monad Questions
2
Solved
Using the StateT monad transformer, I can create the type StateT s [] a, which is isomorphic to s -> [(a, s)]. Now I would prefer to use the STT monad transformer instead, as I would like to hav...
Nimitz asked 16/8, 2018 at 9:59
2
Solved
The ST monad, originally devised by Launchbury and Peyton Jones, allows Haskell programmers to write imperative code (with mutable variables, arrays, etc.) while obtaining a pure interface to that ...
1
Solved
I recently began looking at core libraries on Hackage, and there's a recurring idiom I don't understand. Here's an example from the ST module:
instance Monad (ST s) where
{-# INLINE (>>=) #...
1
Solved
This recent SO question prompted me to write an unsafe and pure emulation of the ST monad in Haskell, a slightly modified version of which you can see below:
{-# LANGUAGE DeriveFunctor, Generalize...
1
I am trying to work out a data structure for the following situation.
Graph Structure
I plan to have a graph of nodes with un-weighted, directed edges: Graph = [Node]
Each node has:
Some TBD i...
1
Solved
I wrote small program in haskell to count all ocurences of Int values in Tree using State Monad with Vector:
import Data.Vector
import Control.Monad.State
import Control.Monad.Identity
data Tree ...
Fieldsman asked 10/5, 2014 at 10:34
1
Solved
Mutable vectors in Haskell have three element-level mutators:
read :: PrimMonad m => MVector (PrimState m) a -> Int -> m a
write :: PrimMonad m => MVector (PrimState m) a -> Int -&g...
Deaconry asked 29/6, 2013 at 9:28
2
Solved
I have some code that currently uses a ST monad for evaluation. I like not putting IO everywhere because the runST method produces a pure result, and indicates that such result is safe to call (ver...
1
© 2022 - 2024 — McMap. All rights reserved.