TL DR
Here is the correct code for main:
main : Signal Element
main = Signal.map render
(Signal.foldp (\(upd, dir) (x, y) ->
(x + dir.x, y + dir.y)) (0,0) input)
Search for a solution
There is a problem with your types. So let's look at some types:
foldp : (a -> b -> b) -> b -> Signal a -> Signal b
input : Signal (Float, {x : Int, y : Int})
render : (Int, Int) -> Element
main : Signal Element
main foldp, foldp main. render , b (Int, Int), (0,0). a . , foldp :
foldp : ((Float, {x : Int, y : Int}) -> (Int, Int) -> (Int, Int)) -- the function
-> (Int, Int) -- the initial value
-> Signal (Float, {x : Int, y : Int}) -- the input
-> Signal (Int, Int) -- the output
, , foldp. ?
(\dir (upd, {x, y}) -> (x + dir.x, y + dir.y)) : {recordExt1 | x : number, y : number'} -> (something, {recordExt2 | x : number, y : number'}) -> (number, number')
.. . .
* , , , recordExt1 = recordExt2 = {}.
* number, , Int s.
* - x y, Float input.
-- simplified type of inline function
{ x : Int, y : Int} -> (Float, { x : Int, y : Int}) -> (Int, Int)
-- function deduced from specialised `foldp` type
(Float, {x : Int, y : Int}) -> (Int, Int) -> (Int, Int)
. , x y.
, main , (x,y) {x,y} (upd,... ) .
fps 25, :
input = Signal.sampleOn (fps 25) Keyboard.arrows
main = Signal.map render
(Signal.foldp (\dir (x, y) ->
(x + dir.x, y + dir.y)) (0,0) input)
.