{"id":16339496,"url":"https://github.com/felixschl/purescript-redux-saga","last_synced_at":"2025-03-22T23:33:02.797Z","repository":{"id":58242434,"uuid":"101207801","full_name":"felixSchl/purescript-redux-saga","owner":"felixSchl","description":"Manageable I/O for Purescript apps -   http://slides.com/felixschl/managing-io-in-purescript","archived":false,"fork":false,"pushed_at":"2018-08-06T17:08:16.000Z","size":76,"stargazers_count":21,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T05:38:08.361Z","etag":null,"topics":["purescript","react","redux","saga"],"latest_commit_sha":null,"homepage":"","language":"PureScript","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/felixSchl.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":"2017-08-23T17:33:00.000Z","updated_at":"2024-11-07T00:05:33.000Z","dependencies_parsed_at":"2022-08-31T00:41:07.206Z","dependency_job_id":null,"html_url":"https://github.com/felixSchl/purescript-redux-saga","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixSchl%2Fpurescript-redux-saga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixSchl%2Fpurescript-redux-saga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixSchl%2Fpurescript-redux-saga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixSchl%2Fpurescript-redux-saga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixSchl","download_url":"https://codeload.github.com/felixSchl/purescript-redux-saga/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245036127,"owners_count":20550662,"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":["purescript","react","redux","saga"],"created_at":"2024-10-10T23:54:27.101Z","updated_at":"2025-03-22T23:33:02.240Z","avatar_url":"https://github.com/felixSchl.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# purescript-redux-saga\n\nRedux-saga inspired library for dealing with I/O in Purescript apps. The idea\nis to completely isolate all I/O from pure code, meaning that neither the\nreducer, nor the components, nor the action creators do _any_ kind of I/O\nleaving the application mostly pure and placing all I/O into a single location.\n\nTo do so, purescript-redux-saga creates a virtual thread of execution whose\ninputs are either actions produced by the UI or attached Sagas, or values\nreceived through \"channels\".\n\n# API Docs\n\nAPI documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-redux-saga).\n\n## Usage Example\n\n``` purescript\n-- Types.purs\ntype GlobalState = {}\ndata Action\n  = LoginRequest { username :: String, password :: String }\n  | LoginFailure Error\n  | LoginSuccess { username :: String, token :: String }\n\n-- Sagas.purs - Perform *all* I/O your app does here\nsaga :: ∀ env. Saga env Action GlobalState Unit\nsaga = forever do\n  take case _ of\n    LoginRequest { username, password } -\u003e Just do\n      liftAff (attempt $ authenticate username password) \u003e\u003e= case _ of\n        Left err    -\u003e put $ LoginFailure err\n        Right token -\u003e put $ LoginSuccess { username, token }\n      _ -\u003e Nothing\n\n-- Store.purs - Install the Saga middleware\nmkStore\n  :: ∀ eff\n   . Eff  (ReduxEffect _)\n          (ReduxStore _ GlobalState Action)\nmkStore = Redux.createStore reducer initialState middlewareEnhancer\n  where\n  initialState = {}\n  middlewareEnhancer = Redux.applyMiddleware\n    [ loggerMiddleware\n    , sagaMiddleware saga\n    ]\n\n-- Main.purs - Tie the bow\nmain :: ∀ e. Eff _ Unit\nmain = do\n  store \u003c- mkStore\n  Redux.createProviderElement store [ Redux.createElement_ appClass [] ]\n```\n\nFor a fully worked example, have a look at [purescript-redux-saga-example](https://github.com/felixschl/purescript-redux-saga-example).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixschl%2Fpurescript-redux-saga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixschl%2Fpurescript-redux-saga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixschl%2Fpurescript-redux-saga/lists"}