{"id":28736177,"url":"https://github.com/foxbenjaminfox/require-haskell","last_synced_at":"2025-06-16T01:05:51.857Z","repository":{"id":57354267,"uuid":"42610372","full_name":"foxbenjaminfox/require-haskell","owner":"foxbenjaminfox","description":"Require haskell functions from NodeJS","archived":false,"fork":false,"pushed_at":"2015-09-29T08:14:43.000Z","size":160,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-26T09:19:29.520Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foxbenjaminfox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-16T20:02:11.000Z","updated_at":"2019-12-10T23:43:44.000Z","dependencies_parsed_at":"2022-09-12T03:11:57.914Z","dependency_job_id":null,"html_url":"https://github.com/foxbenjaminfox/require-haskell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/foxbenjaminfox/require-haskell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxbenjaminfox%2Frequire-haskell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxbenjaminfox%2Frequire-haskell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxbenjaminfox%2Frequire-haskell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxbenjaminfox%2Frequire-haskell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxbenjaminfox","download_url":"https://codeload.github.com/foxbenjaminfox/require-haskell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxbenjaminfox%2Frequire-haskell/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260079420,"owners_count":22955700,"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":"2025-06-16T01:05:51.188Z","updated_at":"2025-06-16T01:05:51.837Z","avatar_url":"https://github.com/foxbenjaminfox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Require-Haskell ![Build Status](https://travis-ci.org/foxbenjaminfox/require-haskell.svg)\n\n`require-haskell` lets you `require` your haskell modules as asynchronous Javascript functions.\n\n## Example\n  var requireH = require('require-haskell');\n\n    // You can now require haskell files with requireH just like you require javascript files using require.\n    var haskellFunction = requireH('/path/to/a/haskell/file.hs');\n\n    // Now you can call this function from your javascript code\n    haskellFunction('arguments', 'go', 'here', function(err, result){\n      // Now do something in the callback\n    });\n\n## Passing and Returning Data\n\nThe Javascript function representing the your Haskell module takes any number of arguments, and then a callback argument as it's last argument. Passing a callback is mandatory.\n\nIn the Haskell file, you can get the arguments passed in through the getArgs function from System.Environment. When your Haskell code is done executing, your callback that you passed gets called, with `error` and `result` arguments represening any errors thrown by the Haskell program or anything the program wrote to stderr in the `error` argument, and anything the program wrote to standard output as the `result` value.\n\n### Environment Variables\nIf you want to call the Haskell module with certain environment variables set, you can pass a second argument when requiring your Haskell module. This argument should be an object containing any environment variables you want to set or overwrite.\n\n#### Example\n\n    var requireH = require('require-haskell');\n    var haskellFunctionWithEnvVariable = requireH('/some/file.hs', { VARNAME: 'foo' });\n    // Now when you call the function, the Haskell module will be run in a context that includes this new environment variable in addition to the ones it inherits from the Node proccess.\n\n## Dependencies\n\nIn order to use this module, you need to have `runhaskell` installed on your system. If you've installed `ghc` you've probably got it. Otherwise, you'll need to install it before you use `require-haskell`.\n\n## Intended Use\n\n`require-haskell` dynamicly runs your Haskell code using `runhaskell`. As such, it's not going to be as perfomant as if you compile the Haskell code up front and manually spawn a subproccess to run your compiled executable. `require-haskell` is not intended for applications which need to do heavy lifting in Haskell, or ones which need to call the imported Haskell function many times per second.\n\nWhat it is good for is scripting, EDSLs, or configuration files writted in Haskell. It's quite likely you'll be able to find even more uses for it. \n\n## Testing\n\nTo run the tests for `require-haskell`, make sure you've installed `jasmine`, and run `npm test`.\n\n## Contributing\nPull requests are welcome. If you've got an idea of how to improve `require-haskell` go right ahead!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxbenjaminfox%2Frequire-haskell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxbenjaminfox%2Frequire-haskell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxbenjaminfox%2Frequire-haskell/lists"}