Skip to content

Space leak Control.Monad.Strict

I wrote some code depending on Control.Monad.State.Strict, with the assumption that it would run in constant space. This assumption was wrong. Why? I included a runnable example.

import Control.Monad.State.Strict

data Foo = Foo !Int !Int deriving Show

foo = flip runState (Foo 1 2) 
           (forever $ 
               Control.Monad.State.Strict.modify (\(Foo a b) -> Foo a (b+1))      
           )
main = putStrLn (show foo)

I labeled it "critical", since not being able to use the State monad is making the code less expressive.

Trac metadata
Trac field Value
Version 6.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information