{"id":18611554,"url":"https://github.com/robertdp/purescript-wire","last_synced_at":"2026-01-25T01:01:46.239Z","repository":{"id":38318392,"uuid":"262990307","full_name":"robertdp/purescript-wire","owner":"robertdp","description":"Events and Signals for FRP. Monad instances included","archived":false,"fork":false,"pushed_at":"2022-12-11T17:29:01.000Z","size":255,"stargazers_count":12,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T14:34:59.223Z","etag":null,"topics":["event","frp","signal","wire"],"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/robertdp.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":"2020-05-11T08:57:36.000Z","updated_at":"2022-05-27T17:49:37.000Z","dependencies_parsed_at":"2023-01-27T04:01:16.911Z","dependency_job_id":null,"html_url":"https://github.com/robertdp/purescript-wire","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/robertdp/purescript-wire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdp%2Fpurescript-wire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdp%2Fpurescript-wire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdp%2Fpurescript-wire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdp%2Fpurescript-wire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertdp","download_url":"https://codeload.github.com/robertdp/purescript-wire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdp%2Fpurescript-wire/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28740391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T22:12:27.248Z","status":"ssl_error","status_checked_at":"2026-01-24T22:12:10.529Z","response_time":89,"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":["event","frp","signal","wire"],"created_at":"2024-11-07T03:14:10.444Z","updated_at":"2026-01-25T01:01:46.216Z","avatar_url":"https://github.com/robertdp.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# purescript-wire\n\nWire aims to provide useful reactive tools: currently `Event` and `Signal`.\n\n## Wire.Event\n\n`Event` models asynchronous, discreet events over time, and are roughly analogous to Observables in RxJS.\n\nNote: this implementation was largely inspired by `FRP.Event` from the [purescript-event](https://github.com/paf31/purescript-event) library. My implementation has a more restricted set of functionality, has immediate unsubscription (which works better when combined with React), and a monad instance.\n\n### Creating an event\n\n```purescript\ncreate :: forall a. Effect { event :: Event a, push :: a -\u003e Effect Unit }\n```\n\nExample:\n\n```purescript\nperiodically :: Milliseconds -\u003e Effect (Event Unit)\nperiodically (Milliseconds ms) = do\n  { event, push } \u003c- Event.create\n  setInterval (Math.floor ms) do\n    push unit\n  pure event\n```\n\n### Subscribing to an event\n\n```purescript\nsubscribe :: forall a b. Event a -\u003e (a -\u003e Effect b) -\u003e Effect (Effect Unit)\n```\n\nExample:\n\n```purescript\nlogToConsole :: forall a. Show a =\u003e Event a -\u003e Effect (Effect Unit)\nlogToConsole event = Event.subscribe event Console.logShow\n```\n\nThe `Effect Unit` being returned from `Event.subscribe` is the subscription canceller.\n\n### Extra functionality\n\n- `fold :: forall a b. (b -\u003e a -\u003e b) -\u003e b -\u003e Event a -\u003e Event b`\n- `share :: forall a. Event a -\u003e Effect (Event a)` (see [#12](https://github.com/robertdp/purescript-wire/issues/12))\n- `distinct :: forall a. Eq a =\u003e Event a -\u003e Event a`\n- `bufferUntil :: forall b a. Event a -\u003e Event b -\u003e Event (Array a)`\n- `fromFoldable :: forall a f. Foldable f =\u003e f a -\u003e Event a`\n- `range :: Int -\u003e Int -\u003e Event Int`\n- `times :: Int -\u003e Event Int`\n\n## Wire.Signal\n\n`Signal` is like `Event` but it models a continuous value over time, with change events. As such you can always read the current value of a signal, as well as subscribe to future changes. Signals are build on top of `Event`, and also have a monad instance.\n\nThis was originally created for modelling application-level reactive state in React, for things like routing and user authentication.\n\n### Creating a signal\n\n```purescript\ncreate :: forall a. a -\u003e Effect { signal :: Signal a, modify :: (a -\u003e a) -\u003e Effect Unit }\n```\n\nExample:\n\n```purescript\ncreateAuthSignal :: Effect { auth :: Signal (Maybe AuthData), login :: AuthData -\u003e Effect Unit, logout :: Effect Unit }\ncreateAuthSignal = do\n  { signal, modify } \u003c- Signal.create Nothing\n  pure\n    { auth: signal\n    , login: \\authData -\u003e modify (const (Just authData))\n    , logout: modify (const Nothing)\n    }\n```\n\n### Sampling a signal\n\n```purescript\nread :: forall a. Signal a -\u003e Effect a\n```\n\n### Subscribing to a signal\n\nSubscribing to a signal is identical to events, with one exception: in the current implementation a signal will push it's current value to a new subscriber immediately (kind of like a `ReplaySubject(1)`).\n\n```purescript\nsubscribe :: forall b a. Signal a -\u003e (a -\u003e Effect b) -\u003e Effect (Effect Unit)\n```\n\n### Extra functionality\n\n- `distinct :: forall a. Eq a =\u003e Signal a -\u003e Signal a`\n- `event :: forall a. Signal a -\u003e Event a`\n- `share :: forall a. Signal a -\u003e Effect (Signal a)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertdp%2Fpurescript-wire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertdp%2Fpurescript-wire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertdp%2Fpurescript-wire/lists"}