{"id":17694866,"url":"https://github.com/gelisam/glut-events","last_synced_at":"2025-03-30T23:42:59.700Z","repository":{"id":66646550,"uuid":"8744011","full_name":"gelisam/glut-events","owner":"gelisam","description":"For writing GLUT's main loop in the style of Haskell's main function.","archived":false,"fork":false,"pushed_at":"2013-04-03T02:57:14.000Z","size":172,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-06T05:17:02.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gelisam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-13T03:16:06.000Z","updated_at":"2019-12-05T06:32:45.000Z","dependencies_parsed_at":"2023-02-20T08:30:41.415Z","dependency_job_id":null,"html_url":"https://github.com/gelisam/glut-events","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gelisam%2Fglut-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gelisam%2Fglut-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gelisam%2Fglut-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gelisam%2Fglut-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gelisam","download_url":"https://codeload.github.com/gelisam/glut-events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246395572,"owners_count":20770240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T13:50:07.675Z","updated_at":"2025-03-30T23:42:59.683Z","avatar_url":"https://github.com/gelisam.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"glut-events\n===========\n\nFor writing GLUT's main loop in the style of Haskell's main function.\n\n(in development)\n\n\npurpose\n-------\n\nHaskell's [Graphics.UI.GLUT](http://cvs.haskell.org/Hugs/pages/libraries/GLUT/Graphics-UI-GLUT.html) library exposes [GLUT](http://www.opengl.org/resources/libraries/glut/)'s approach to event handling: register global callbacks for the Keyboard, Mouse, Timer, Resizing, Redrawing, and Idle events. This encourages a style of development focussing on a shared global state, a style which is not typical in Haskell.\n\nThe purpose of this library will be to offer a Haskell-style wrapper around GLUT's platform-independent Input and Timing routines. In particular, much like Haskell's main method is typically written as an infinite tree of alternative IO sequences:\n\n    main = do putStrLn \"are you sure? (y/n)\"\n              s \u003c- getLine\n              case s of\n                \"y\" -\u003e putStrLn \"full steam ahead!\"\n                \"n\" -\u003e putStrLn \"ok then.\"\n                _ -\u003e do putStrLn \"please answer with 'y' or 'n'.\"\n                        main\n\nThe goal is to allow you to write GLUT programs as an infinite tree of alternatives in some yet-to-be-determined monad:\n\n    glutMessage = do clear [ColorBuffer]\n                     renderString Helvetica18 \"are you sure? (y/n)\"\n                     swapBuffers\n    \n    glut_main = do lift $ glutMessage \"are you sure? (y/n)\"\n                   Char c \u003c- getKeypress\n                   case c of\n                     'y' -\u003e lift $ glutMessage \"full steam ahead!\"\n                     'n' -\u003e lift $ glutMessage \"ok then.\"\n                     _ -\u003e do lift $ glutMessage \"please answer with 'y' or 'n'.\"\n                             waitForTimeout 1000\n                             glut-main\n\n\nlong term goal\n--------------\n\nThe above doesn't look to hard to implement. The hard part would be to allow waiting on multiple events (C-style \u003ctt\u003eselect()\u003c/tt\u003e), forking cooperative threads, sending events between threads, and releasing GLUT's idle callback when no threads are waiting for input. I still have no idea how to do this in a typesafe way, though, so don't hold your breath!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgelisam%2Fglut-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgelisam%2Fglut-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgelisam%2Fglut-events/lists"}