Path taken by Haskell's putStrLn to reach write() syscall

Viewed 113

For a simple Haskell program like

main = putStrLn "Hello"

I would like to know where it exits the functional world of Haskell and enters C. If I try to set a breakpoint in ghci at putStrLn I get an error:

ghci> :break putStrLn 
cannot set breakpoint on putStrLn: module System.IO is not interpreted

Is there some other way from inside ghci to set a breakpoint in the internal IO functions (maybe some special option or by compiling ghci in a special way ?). I would like to follow putStrLn into libraries/Base/System/IO.hs (putStrLn) or further up in libraries/Base/GHC/IO/Handle/Text.hs (hPutStrLn) to see where it enters C code.

Or maybe someone can sketch which paths is taken until the write() syscall is reached?

0 Answers
Related