bodil/purescript-signal
Fork: 44 Star: 258 (更新于 2024-11-01 10:44:44)
license: Apache-2.0
Language: PureScript .
Elm style FRP library for PureScript
最后发布版本: v13.0.0 ( 2022-05-02 14:21:08)
purescript-signal
Signal is a lightweight FRP-like library heavily inspired by the Elm Signal implementation. Where possible and sensible, it tries to maintain API equivalence with Elm.
See the Elm documentation for details on usage and principles.
PureScript Usage Patterns
PureScript depends on effects (specifically, the Effect
monad) to manage side effects, where Elm's runtime generally manages them for you. purescript-signal
provides the Signal.runSignal
function for running effectful signals.
module Main where
import Effect.Console
import Effect (Effect)
import Prelude
import Signal
hello :: Signal String
hello = constant "Hello Joe!"
helloEffect :: Signal (Effect Unit)
helloEffect = hello ~> log
main = runSignal helloEffect
This simple example takes a constant signal which contains the string "Hello Joe!"
and maps it over the Effect.Console.log
function, which has the type String -> Effect Unit
, thus taking the String
content of the signal and turning it into an effect which logs the provided string to the user's console.
This gives us a Signal (Effect Unit)
. We use runSignal
to take the signal of effects and run each effect in turn—in our case, just the one effect which prints "Hello Joe!"
to the console.
API Documentation
Usage Examples
- The canonical Elm Mario: https://github.com/michaelficarra/purescript-demo-mario
- Ponies: https://github.com/bodil/purescript-is-magic
最近版本更新:(数据更新于 2024-09-07 10:29:54)
2022-05-02 14:21:08 v13.0.0
2018-06-07 19:28:36 v10.1.0
2018-06-01 14:52:09 v10.0.0
bodil/purescript-signal同语言 PureScript最近更新仓库
2024-02-13 14:28:23 nammayatri/nammayatri
2019-06-11 06:31:45 bodil/purescript-smolder
1970-01-01 00:00:00 sharkdp/cube-composer
1970-01-01 00:00:00 paluh/purescript-undefined-is-not-a-problem