Skip to content

Instantly share code, notes, and snippets.

-- pulp dep install --save purescript-signal
import Prelude
import Signal as S
import Signal.Channel as C
let c = C.channel 0
let s = C.subscribe c
module PortTest where
import Debug exposing (log)
import Html exposing (div, text)
import Html.Attributes exposing (id)
import Html.Events exposing (onClick)
import Signal
import Task exposing (Task (..))
outputSignal : Signal.Mailbox String
module PortTest where
import Debug exposing (log)
import Html exposing (div, text)
import Html.Attributes exposing (id)
import Html.Events exposing (onClick)
import Signal
import Task exposing (Task (..))
outputSignal : Signal.Mailbox String
module PortTest where
{--
<html>
<head>
<script src='port-test.js'></script>
</head>
<body>
<div id='port-test'></div>
<script>
@prozacchiwawa
prozacchiwawa / gist:0625666c2a4a231e602f
Created February 2, 2016 08:47
Port test where outputPort depends on app.model.
module PortTest where
{--
<html>
<head>
<script src='port-test.js'></script>
</head>
<body>
<div id='port-test'></div>
<script>
module PortTest2 where
import Debug
import Signal exposing (Mailbox, mailbox, Address)
import Effects exposing (Effects, none, Never)
import Basics exposing (toString)
import String
import Task
import Html exposing (Html, text, button, div)
import Html.Events exposing (onClick)
module Main where
import Prelude
import DOM.Node.Types (ElementId(..))
import Signal.Channel
import React
module StartApp.StartApp ( start, Config, App ) where
{-| This module helps you start your application in a typical Elm workflow.
It assumes you are following [the Elm Architecture][arch] and using
[elm-effects][]. From there it will wire everything up for you!
**Be sure to [read the Elm Architecture tutorial][arch] to learn how this all
works!**
[arch]: https://github.com/evancz/elm-architecture-tutorial
[elm-effects]: http://package.elm-lang.org/packages/evancz/elm-effects/latest
...
purposeUpdate : (PU.Model -> (PU.Model, Effects PU.Action)) -> Model -> (Model, Effects Action)
purposeUpdate u m =
let finishPurposeUpdate p =
let (pm,e) = u p in
let newEffects = Effects.map Purpose e in
(PurposeModel pm, newEffects)
in
let updatePurpose y =
import Effects exposing (Effects(..), Never)
import Html exposing (Html, div, button, text)
import Html.Attributes exposing (value)
import Html.Events exposing (onClick)
import Signal exposing (Mailbox)
import StartApp as SA
import Task exposing (Task(..))
type Request = DummyRequest | Request String
type Response = Response String