1

I'm trying Threepenny gui in Haskell with ghc-8.0.1, running in cygwin on Windows 10, using Chrome. But I can get only one of the sample programs to work.

I launched the Buttons example from the Threepenny gui samples (runhaskell Buttons.hs), and the gui displayed fine in Chrome. Then I closed the Chrome tab, and tried another example (Canvas.hs). When I entered http://localhost:8023 into Chrome, it brought up the Buttons example again, not Canvas. I've tried several approaches to terminate Buttons, and I've tried most of the other examples in the samples directory, but Buttons always comes up in the browser. The other examples (Canvas etc.) all run fine in the cygwin bash shell, but Buttons always appears in the browser (and Buttons works interactively).

What I've tried: killing the Buttons program. Using http://127.0.0.1:8023. Killing the bash shell and launching a new one. Killing Chrome and launching a new Chrome process. Doing ps to make sure no Haskell process is running, then starting a new bash shell. Trying Firefox. Trying Edge. Removing the History (in all three browsers).

Is there a buffer or stream that has to be cleared manually? How can I run Canvas after having run Buttons: what am I doing wrong? Can a Threepenny application terminate itself cleanly to prevent this problem?

John O'D
  • 81
  • 3
  • What browser you use and whether you kill it won't bother threepenny in the least – this is all about the server process. In what way did you “kill the Buttons program” (and how exactly did you launch it, anyway)? – leftaroundabout Sep 18 '16 at 15:34
  • I launched it in a bash shell under cygwin with runhaskell Buttons.hs. I killed it by ^C in the bash shell. Also, I killed the shell, and checked that no Haskell process or bash process was running using ps. The browser I used: Chrome, Firefox, and Edge. – John O'D Sep 18 '16 at 16:17
  • Well, ^C _should_ be enough, but cygwin terminals may be at times a bit strange with keyboard commands. Note that `runhaskell` is an alias for `runghc`, and as such it will turn up in `ps`. Sure there is no such process left? – leftaroundabout Sep 18 '16 at 16:29
  • 1
    You're right, you nailed it! There is a ghc process still running! In bash, ps -a shows three processes: mintty, ps, bash but I just tried ps in powershell, and it does show ghc running. Apparently the ^C in bash didn't actually kill the ghc process, and bash ps didn't display ghc running. Using powershell I killed ghc, and now the other samples (Canvas etc) work fine. You pointed me in the right direction, thanks very much! Bottom line: don't assume ^C in bash will kill ghc even if ps doesn't show ghc running. – John O'D Sep 18 '16 at 17:39
  • 1
    Yes, that is: don't assume ^C _in Cygwin_ will kill the processes. In a native Unix environment, this does work quite reliably! – leftaroundabout Sep 18 '16 at 17:51

0 Answers0