Skip to content

(OS X) Can't link MonadCont, but ghci works

The following test case prints [0,1,2] with ghci-6.4 on
OS X, but ghc can't link it.  The error is

$ ghc-6.4 -o y yield-cont-fails.hs

ld: Undefined symbols:
_ControlziMonadziCont_zdfMonadCont_closure
___stginit_ControlziMonadziCont_


The test case:

import Control.Monad.Cont

yield :: a -> Cont [a] ()
yield x = Cont (\c -> x : c ())

asGenerator :: Cont [a] v -> [a]
asGenerator (Cont f) = f (const [])

test = asGenerator (yield 0 >> yield 1 >> yield 2)

main = do print test

I have also attached it as a file to this bug.  I do
not have other versions of ghc installed.  I installed
GHC from

http://www.haskell.org/ghc/dist/6.4/MacOSX/GHC-6.4.pkg.zip
Trac metadata
Trac field Value
Version 6.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedInvalid
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information