{"id":13396955,"url":"https://github.com/paf31/purescript-thermite","last_synced_at":"2026-01-28T15:06:07.319Z","repository":{"id":24837212,"uuid":"28251951","full_name":"paf31/purescript-thermite","owner":"paf31","description":"A simple PureScript wrapper for React","archived":false,"fork":false,"pushed_at":"2022-12-02T23:17:48.000Z","size":533,"stargazers_count":348,"open_issues_count":14,"forks_count":52,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-10-19T06:52:32.861Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureScript","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/paf31.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":"2014-12-20T00:39:33.000Z","updated_at":"2025-10-06T18:34:44.000Z","dependencies_parsed_at":"2022-07-25T14:32:36.275Z","dependency_job_id":null,"html_url":"https://github.com/paf31/purescript-thermite","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/paf31/purescript-thermite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paf31%2Fpurescript-thermite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paf31%2Fpurescript-thermite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paf31%2Fpurescript-thermite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paf31%2Fpurescript-thermite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paf31","download_url":"https://codeload.github.com/paf31/purescript-thermite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paf31%2Fpurescript-thermite/sbom","scorecard":{"id":717716,"data":{"date":"2025-08-11","repo":{"name":"github.com/paf31/purescript-thermite","commit":"0611b86f121206f77ee82323bf8caf0e1e7be64a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"44 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-wg6g-ppvx-927h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-5g97-whc9-8g7j","Warn: Project is vulnerable to: GHSA-8r4g-cg4m-x23c","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-pq67-2wwv-3xjx","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v","Warn: Project is vulnerable to: GHSA-884p-74jh-xrg2","Warn: Project is vulnerable to: GHSA-j7fq-p9q7-5wfv"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T10:14:24.756Z","repository_id":24837212,"created_at":"2025-08-22T10:14:24.757Z","updated_at":"2025-08-22T10:14:24.757Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28846109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T13:02:32.985Z","status":"ssl_error","status_checked_at":"2026-01-28T13:02:04.945Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-30T18:01:08.382Z","updated_at":"2026-01-28T15:06:07.300Z","avatar_url":"https://github.com/paf31.png","language":"PureScript","readme":"## purescript-thermite\n\n[![Pursuit](http://pursuit.purescript.org/packages/purescript-thermite/badge)](http://pursuit.purescript.org/packages/purescript-thermite/)\n\n`purescript-thermite` is a PureScript wrapper for [`purescript-react`](http://github.com/purescript-contrib/purescript-react). It does not provide all of the functionality of React, but instead provides a clean API to the most commonly-used parts of its API. It is possible to use `purescript-react` for more specialized use cases.\n\n- [Try Thermite!](http://try.purescript.org/?backend=thermite)\n- [Module Documentation](generated-docs/Thermite.md)\n- [Task List Example](http://try.purescript.org/?gist=f5f273e4c5e4161fceff\u0026backend=thermite)\n\n## Building\n\n```\nbower update\npulp build\npulp test -r cat \u003e html/index.js\n```\n\nYou can also now use `npm test` to run the test command above.\n\n## Getting Started\n\nThermite components are defined in parts:\n\n- A type of _actions_, which represents the actions a user can take on our component\n- A type of _states_, which represents the internal state of our component\n- An initial state\n- A rendering function, which takes the current component state and properties, and creates a HTML document\n- A function which interprets _actions_, by modifying the state and/or running some (possibly asynchronous) computations\n\nHere is an example. We'll build a component which displays the value of a integer-valued counter.\n\nFirst of all, we need to import some modules:\n\n```purescript\nimport Thermite as T\n\nimport React as R\nimport React.DOM as R\nimport React.DOM.Props as RP\nimport ReactDOM as RDOM\n```\n\nIn our component, users will be able to take two actions - increment and decrement - which will be represented as buttons later:\n\n```purescript\ndata Action = Increment | Decrement\n```\n\nThe state of our component is just an integer:\n\n```purescript\ntype State = { counter :: Int }\n```\n\nThe initial state is zero:\n\n```purescript\ninitialState :: State\ninitialState = { counter: 0 }\n```\n\nOur rendering function uses the `React.DOM.*` modules to create a HTML document containing a label and two buttons. The buttons' `onclick` handlers are given functions which generate the correct actions. The `dispatch` function, which is passed as the first argument to `render`, can be used to build such a function, by providing an action:\n\n```purescript\nrender :: T.Render State _ Action\nrender dispatch _ state _ =\n  [ R.p' [ R.text \"Value: \"\n         , R.text $ show state.counter\n         ]\n  , R.p' [ R.button [ RP.onClick \\_ -\u003e dispatch Increment ]\n                    [ R.text \"Increment\" ]\n         , R.button [ RP.onClick \\_ -\u003e dispatch Decrement ]\n                    [ R.text \"Decrement\" ]\n         ]\n  ]\n```\n\nThe `performAction` function interprets actions by passing a function to the state update function, which is responsible for updating the state using record updates:\n\n```purescript\nperformAction :: T.PerformAction State _ Action\nperformAction Increment _ _ = void (T.cotransform (\\state -\u003e state { counter = state.counter + 1 }))\nperformAction Decrement _ _ = void (T.cotransform (\\state -\u003e state { counter = state.counter - 1 }))\n```\n\n_Note_: `PerformAction` returns a _coroutine_, which can emit many asynchronous state updates using `cotransform`. This approach also allows us to create asynchronous and/or chunked action handlers (using AJAX or websockets, for example):\n\n```purescript\ngetIncrementValueFromServer :: Aff Int\n\nperformAction :: T.PerformAction State _ Action\nperformAction Increment _ _ = do\n  Just amount \u003c- lift getIncrementValueFromServer\n  void $ T.cotransform $ \\state -\u003e state { counter = state.counter + amount }\n```\n\nWith these pieces, we can create a `Spec` for our component:\n\n```purescript\nspec :: T.Spec State (T.WithChildren ()) Action\nspec = T.Spec {performAction, render}\n```\n\n\u003e Note that the new purescript-react needs some typechecking assistance\n\u003e for `props` - `Spec` needs an extra `{ children :: Children | props }` field in its props,\n\u003e yet that field is not necessary when creating a react element with its `props` argument.\n\u003e\n\u003e `WithChildren props` is just an alias for `{ children :: Children | props }`.\n\nFinally, in `main`, the `defaultMain` function from the\n[purescript-thermite-dom](https://github.com/athanclark/purescript-thermite-dom)\nlibrary can be used to render our component to the document body by specifying the initial state:\n\n```purescript\nimport Thermite.DOM (defaultMain)\n\nmain = defaultMain spec (const initialState) \"MyComponent\" {}\n```\n\n## Combining Components\n\nThe `Spec` type is an instance of the `Semigroup` and `Monoid` type classes. These instances can be used to combine different components with the same `state` and `action` types.\n\nIn practice, the `state` and `action` types will not always match for the different subcomponents, so Thermite provides combinators for changing these type arguments: `focus` and `foreach`. These combinators are heavily inspired by the [OpticUI](https://github.com/zrho/purescript-optic-ui) library.\n\nSee the [example project](test/) for examples of these kinds of composition.\n\n### `focus`\n\n`focus` (and the related functions `focusState` and `match`) are used to enlarge the state and action types, to make it possible to embed a component inside a larger component.\n\n`focus` takes a _lens_, which identifies the `state` type as a part of the state type of the larger component, and a _prism_, which identifies all actions of the smaller component as actions for the larger component. `focusState` is used when only the `state` type needs to be changed, and `match` is used when only the `action` type needs to be changed.\n\nAs a simple example, we can combine two subcomponents by using a `Tuple` to store both states, and `Either` to combine both sets of actions:\n\n```purescript\nspec1 :: Spec S1 _ A1\nspec2 :: Spec S2 _ A2\n\nspec :: Spec (Tuple S1 S2) _ (Either A1 A2)\nspec = focus _1 _Left spec1 \u003c\u003e focus _2 _Right spec2\n```\n\nHere, `_1` and `_Left` embed `spec1` inside `spec`, using the left components of both the state `Tuple` and the `Either` type of actions. `_2` and `_Right` similarly embed `spec2`, using the right components.\n\n_focus_ is responsible for directing the various actions to the correct components, and updating the correct parts of the state.\n\n### `split`\n\n`split` is used to handle child components which might not be present, for\nexample, when a parent object contains a `Maybe` state.\n\n```purescript\ntype Parent = { child :: Maybe child }\n\n_child :: LensP Parent (Maybe Child)\n_child = lens _.child (_ { child = _ })\n\n_ChildAction :: PrismP ParentAction ChildAction\n\nchildSpec :: Spec Child _ ChildAction\n\nspec :: Spec Parent _ ParentAction\nspec = focus _child _ChildAction $ split _Just childSpec\n```\n\n### `foreach`\n\nWhere `focus` embeds a single subcomponent inside another component, `foreach` embeds a whole collection of subcomponents.\n\n`foreach` turns a `Spec eff state props action` into a `Spec eff (List state) props (Tuple Int action)`. Note that the state type has been wrapped using `List`, since the component now tracks state for each element of the collection. Also, the `action` type has been replaced with `Tuple Int action`. This means that when an action occurs, it is accompanied by the index of the element in the collection which it originated from.\n","funding_links":[],"categories":["Frontend","Libraries and Tools","Frameworks","UI Libraries"],"sub_categories":["Web Development","Rest of the Pack"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaf31%2Fpurescript-thermite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaf31%2Fpurescript-thermite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaf31%2Fpurescript-thermite/lists"}