I am trying to write a slideshow presentation that updates the URL hash based on the current slide number. I am trying to use the
elm-history library to do it.
Here is the type signature of the function I would like to use:
setPath : String -> Task error ()
Unfortunately I have no idea how to call that on a key press. All the examples I have seen regarding Tasks use dom event handlers, but I don't want to use them.
Here is a reduced example of the thing I'm trying to do:
import History
import Graphics.Element exposing (Element, show)
import Mouse
import Signal exposing ((<~))
type alias Model = Int
init : Model
init = 0
update : (Int, Int) -> Model -> Model
update (x, _) model =
let model' = x
_ = History.setPath ("#" ++ toString x) -- Should alter the URL :/
in
model'
input : Signal (Int, Int)
input = Mouse.position
view : Model -> Element
view = show
main : Signal Element
main =
view
<~ Signal.foldp update init input
gist
I've attempted to use mailboxes, but didn't get very far.