Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running gloss in ghci: closing the window with ESC produces "too many hs-exit()s" #50

Open
andrewufrank opened this issue Jul 31, 2022 · 1 comment

Comments

@andrewufrank
Copy link

I want to use gloss with ghci (either stack repl or cabal repl. The gloss window opens nicely but when I close it, it also closes ghci. In an old but report I saw that the gloss window can be closed with ESC which returns control then to ghci. When I try this I get:

<interactive>: interrupted
<interactive>: warning: too many hs_exit()s

and ghci is closed.

I saw some discussion about running gloss with some flags (??), but could not find a comprehesible and likely up-to-date instruction. What is the correct procedure to run gloss graphics in ghci and how to interact with the windows (especially how to close them without closing ghci ?
Thank you!

I work with ghc 8.10.7 and gloss 1.13.2.1 (lts-18.28

@boblehest
Copy link

boblehest commented Sep 26, 2022

I see this issue is old, but I thought I might as well provide some pointers in case someone else comes by with the same problem;

Regarding flags I assume you mean compiling gloss to use the GLFW backend. If you're using cabal, you can add a file named cabal.project to the root folder of your project, with the following contents:

packages: .

constraints: gloss +GLFW -GLUT

This fixes the ghci problems for me, but on Windows (using freeGLUT) it causes gloss to crash when trying to render text.

I made a fork that works for me with freeGLUT on Windows (though it most likely doesn't work with old GLUT). To use it, I use the following cabal.project config:

packages: .

source-repository-package
    type: git
    location: https://github.com/boblehest/gloss
    tag: 3a75b107ff4df473c8ec5e023a4a8689b07393a4
    subdir: gloss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants