Questions tagged [elm-signal]

Migration to commands:

15 questions
11
votes
1 answer

Did Signal get renamed or removed from Elm v0.17?

I am following the tutorial of http://www.elm-tutorial.org/020_signals/introduction.html elm. When I tried to execute the Signals example. I got the following error. Exception : Cannot find variable `Signal.map`. 12| Signal.map view Mouse.x …
Ranjith Raj D
  • 184
  • 2
  • 12
3
votes
1 answer

how to merge two signals with SampleOn in Elm

I try to merge two signals. One is Mouse.clicks and another is Keyboard.space. On clicks, I should get a Signal(Int,Int) from Mouse.position as return value On space, I should get something different so I can identify different signal is…
SwordW
  • 592
  • 2
  • 6
  • 20
3
votes
2 answers

How to get the current value of a Signal in Elm?

Is there a way to get the current value of a given signal? Or, is this something that I shouldn't want to do when writing idiomatic Elm?
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
3
votes
1 answer

Keyboard keyup signal missing

I need Keyboard keyup signal. But the STD library has only keydown which causes "freezes" in my program thanks to very fast changing game state (pause and play). How to solve it?
rosetree
  • 305
  • 2
  • 9
2
votes
1 answer

Cannot read property 'kids' of undefined - or how to break a circular dependency of signals in Elm?

While elm-make succeeds, I get the following error in the browser: Cannot read property 'kids' of undefined I assume it's because I have a circular dependency of signals: model -> clicks -> model Here is the relevant code: model : Signal…
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
2
votes
1 answer

How to Debug.log a signal in Elm?

I'm trying to introduce a new signal into my program which main function looks like this: main : Signal Html main = Signal.map2 view Window.dimensions model (more context here) To design my new signal I'd like to start from this one: clicks :…
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
2
votes
2 answers

Create a Signal from a List

Is it possible to create a Signal from a List? Essentially what I want is something with the signature List a -> Signal a. I know that a Signal represents a time-varying value and so something like this doesn't actually make any sense (i.e. I can't…
robertjlooby
  • 7,160
  • 2
  • 33
  • 45
2
votes
2 answers

Extract data from a signal

I have a signal like this: signal1 = Signal.constant {a=4, b=3, l = []} How do I extract a data from the signal? I have tried Signal.map (\x -> x) signal1 but Signal.map returns another signal.
Darek Nędza
  • 1,420
  • 1
  • 12
  • 19
2
votes
2 answers

Elm - How to modify the parameterisation of one signal based on another signal

How can I parameterise one signal based on another signal? e.g. Suppose I wanted to modify the fps based on the x-position of the mouse. The types are: Mouse.x : Signal Int fps : number -> Signal Time How could I make Elm understand something…
icz
  • 537
  • 1
  • 7
  • 14
1
vote
1 answer

Elm output port is not working with a signal derived from StartApp

We're learning Elm basics and building a simple application with some audio output with the following setup: We are using Elm's StartApp. We have ports/audio.js with some POC audio logic (and console.log). ATM we are using elm-live to run the…
Touko
  • 11,359
  • 16
  • 75
  • 105
1
vote
1 answer

Signal (Int, Int) not recognised as (Int, Int) tuple in some cases

Depending on the return type, Signal (Int, Int) is not recognised as a tuple of (Int, Int). Consider the following code: import Graphics.Element exposing (..) import Mouse relativeMouseElement : (Int, Int) -> Element relativeMouseElement mp =…
skay-
  • 1,546
  • 3
  • 16
  • 26
1
vote
1 answer

How to sampleOn signal and keep the sampled value in Elm?

Consider a model: model : Signal Model and the following 2 signals: clickPosition = Mouse.position |> Signal.sampleOn Mouse.clicks and: dimensions = Window.dimensions I'd like to get the following desiredSignal: (0,0) (30,20) …
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
1
vote
1 answer

How to propagate clicks signal to model update in Elm?

I'm writing a game in Elm and in this game there's a button that when pressed should reset the game board to its initial state. I don't understand however how a button click signal is to be propagated to the board model's update function. In the…
Christian
  • 7,433
  • 4
  • 36
  • 61
0
votes
1 answer

Make on-screen button signal act like Keyboard signals

The core Keyboard signals, Keyboard.space for example, are True when the given key is pressed and False otherwise. I want to give the signal from an on-screen button the same property. I've got a button that sends a Bool to a mailbox, but it always…
Ryan1729
  • 940
  • 7
  • 25
0
votes
1 answer

Understanding this signal code

I am reading this bit of code since yesterday and trying to come up with a reasonable explanation, could you please check that my assumptions are correct. This code comes from here. port requests : Signal (Task x ()) port requests = Signal.map…
Alberto Zaccagni
  • 30,779
  • 11
  • 72
  • 106