strictness Questions
1
Solved
The source code for Control.Parallel.Strategies ( http://hackage.haskell.org/packages/archive/parallel/3.1.0.1/doc/html/src/Control-Parallel-Strategies.html#Eval ) contains a type Eval defined as:
...
Terrorize asked 6/8, 2012 at 15:22
4
Solved
I have a piece of code that repeatedly samples from a probability distribution using sequence. Morally, it does something like this:
sampleMean :: MonadRandom m => Int -> m Float -> m Flo...
Austria asked 21/7, 2012 at 17:42
1
Solved
I have a problem that I don't know how to reason about. I was just about to ask if somebody could help me with the specific problem, but it dawned on me that I could ask a more general question and...
Intellectualize asked 7/7, 2012 at 3:43
1
Solved
One irritation with lazy IO caught to my attention recently
import System.IO
import Control.Applicative
main = withFile "test.txt" ReadMode getLines >>= mapM_ putStrLn
where getLines h = l...
Latisha asked 24/2, 2012 at 0:28
2
Solved
Haskell has two left fold functions for lists: foldl, and a "strict" version, foldl'. The problem with the non-strict foldl is that it builds a tower of thunks:
foldl (+) 0 [1..5]
--> ((((0 + ...
Minardi asked 23/11, 2011 at 0:21
2
Solved
There are two strict versions of zipWith function:
1) Really strict, elements of lists l1 and l2 get evaluated so their thunks do not eat all stack space (Don Stewart code)
zipWith' f l1 l2 = [ f...
Respirator asked 28/6, 2011 at 8:59
2
Solved
I made really time consuming algorithm which produces a short string as the result. When I try to print it (via putStrLn) it appears on the screen character by character. I did understand why that ...
Recalesce asked 5/4, 2011 at 20:23
3
Solved
Unboxed types, like Int#, and strict functions, like f (!x) = ..., are something different, but I see conceptual similarity - they disallow thunks/laziness in some way. If Haskell was a strict lang...
Busyness asked 28/6, 2010 at 10:18
© 2022 - 2024 — McMap. All rights reserved.