Skip to content

runtime error when using par/seq in a monad

The following version of parfib dies with the following message, but the version after the error message works:

parfib 0 = return 1
parfib 1 = return 1
parfib n = do
              n1 <- parfib (n - 1)
              n2 <- parfib (n - 2)
              n3 <- (n1 `par` (n2 `seq` (return (n1 + n2 + 1))))
              return n3
sh-2.04$ ./Main +RTS -N4 -sstderr
c:\msys\1.0\ghc6.5\bin\Main.exe +RTS -N4 -sstderr
Main.exe: internal error: evacuate: strange closure type 8208
    (GHC version 6.5.20060619 for i386_unknown_mingw32)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

This version of parfib works

parfib 0 = return 1
parfib 1 = return 1
parfib n = do
              n1 <- parfib (n - 1)
              n2 <- parfib (n - 2)
              return (n1 `par` (n2 `seq` (n1 + n2 + 1)))
Edited by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information