{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/elm-reactor/issues/74","labels_url":"https://api.github.com/repos/elm-lang/elm-reactor/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/elm-reactor/issues/74/comments","events_url":"https://api.github.com/repos/elm-lang/elm-reactor/issues/74/events","html_url":"https://github.com/elm-lang/elm-reactor/issues/74","id":55380959,"number":74,"title":"Hotswap kind of broken by this signal-switching code","user":{"login":"jastice","id":770879,"avatar_url":"https://avatars.githubusercontent.com/u/770879?v=3","gravatar_id":"","url":"https://api.github.com/users/jastice","html_url":"https://github.com/jastice","followers_url":"https://api.github.com/users/jastice/followers","following_url":"https://api.github.com/users/jastice/following{/other_user}","gists_url":"https://api.github.com/users/jastice/gists{/gist_id}","starred_url":"https://api.github.com/users/jastice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jastice/subscriptions","organizations_url":"https://api.github.com/users/jastice/orgs","repos_url":"https://api.github.com/users/jastice/repos","events_url":"https://api.github.com/users/jastice/events{/privacy}","received_events_url":"https://api.github.com/users/jastice/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/elm-lang/elm-reactor/milestones/1","html_url":"https://github.com/elm-lang/elm-reactor/milestones/Swapping","labels_url":"https://api.github.com/repos/elm-lang/elm-reactor/milestones/1/labels","id":1100596,"number":1,"title":"Swapping","description":"Fix all of the swapping issues people have run into","creator":{"login":"evancz","id":1658058,"avatar_url":"https://avatars.githubusercontent.com/u/1658058?v=3","gravatar_id":"","url":"https://api.github.com/users/evancz","html_url":"https://github.com/evancz","followers_url":"https://api.github.com/users/evancz/followers","following_url":"https://api.github.com/users/evancz/following{/other_user}","gists_url":"https://api.github.com/users/evancz/gists{/gist_id}","starred_url":"https://api.github.com/users/evancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evancz/subscriptions","organizations_url":"https://api.github.com/users/evancz/orgs","repos_url":"https://api.github.com/users/evancz/repos","events_url":"https://api.github.com/users/evancz/events{/privacy}","received_events_url":"https://api.github.com/users/evancz/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":4,"state":"open","created_at":"2015-05-07T17:24:03Z","updated_at":"2015-07-16T02:06:51Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-01-24T18:57:20Z","updated_at":"2015-07-16T02:06:51Z","closed_at":"2015-07-16T02:06:51Z","body":"Directly related to https://github.com/elm-lang/core/issues/132\r\nThe same code breaks when hotswapping. To reproduce:\r\n\r\n1. run code below in debug mode in elm-reactor 0.3\r\n2. change something (for example image dimensions)\r\n3. the hotswap will usually happen, but the script seems blocked (animations will stop, no more response to arrow keys)\r\n\r\n```elm\r\nmodule Bugs where\r\n\r\nimport List ((::), foldr, length, drop, head)\r\nimport Signal (Signal, (<~), (~), constant, foldp, map2)\r\nimport Graphics.Element (..)\r\nimport Keyboard\r\nimport Debug\r\nimport Text (centered, fromString)\r\n\r\n\r\nslides = [\r\n  constant <| centered <| fromString \"use arrow keys to go forward/backward\",\r\n  constant <| fittedImage 100 500 \"https://raw.githubusercontent.com/elm-lang/elm-lang.org/master/resources/shells.jpg\",\r\n  constant <| fittedImage 700 500 \"https://raw.githubusercontent.com/elm-lang/elm-lang.org/master/resources/book.jpg\",\r\n  constant <| centered <| fromString \"edit something while looking at this in elm-reactor, the script will stop\"\r\n  ]\r\n\r\nlastSlide = length slides - 1\r\nupdateSlide {x,y} current = \r\n  let nextSlide = case x of\r\n        -1 -> current - 1\r\n        1 -> current + 1\r\n        _ -> current\r\n  in clamp 0 lastSlide nextSlide \r\n\r\nchooseSlide: Int -> (List a -> a)\r\nchooseSlide page = drop page >> head\r\n\r\n-- signals\r\n\r\ndisplaySlide: Int -> Signal Element\r\ndisplaySlide page = drop page slides |> head\r\n\r\ncurrentSlide = foldp updateSlide 0 Keyboard.arrows\r\n\r\nmain = applyMany (chooseSlide <~ currentSlide) slides\r\n\r\n\r\n-- debug\r\nslideWatch = Debug.watch \"slide\" <~ currentSlide\r\n\r\n\r\n-- taken from elm-signal-extra\r\n\r\ncombine : List (Signal a) -> Signal (List a)\r\ncombine = foldr (map2 (::)) (constant [])\r\n\r\napplyMany : Signal (List a -> b) -> List (Signal a) -> Signal b\r\napplyMany fs l = fs ~ combine l\r\n```"},"comment":{"url":"https://api.github.com/repos/elm-lang/elm-reactor/issues/comments/121800341","html_url":"https://github.com/elm-lang/elm-reactor/issues/74#issuecomment-121800341","issue_url":"https://api.github.com/repos/elm-lang/elm-reactor/issues/74","id":121800341,"user":{"login":"vilterp","id":7341,"avatar_url":"https://avatars.githubusercontent.com/u/7341?v=3","gravatar_id":"","url":"https://api.github.com/users/vilterp","html_url":"https://github.com/vilterp","followers_url":"https://api.github.com/users/vilterp/followers","following_url":"https://api.github.com/users/vilterp/following{/other_user}","gists_url":"https://api.github.com/users/vilterp/gists{/gist_id}","starred_url":"https://api.github.com/users/vilterp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vilterp/subscriptions","organizations_url":"https://api.github.com/users/vilterp/orgs","repos_url":"https://api.github.com/users/vilterp/repos","events_url":"https://api.github.com/users/vilterp/events{/privacy}","received_events_url":"https://api.github.com/users/vilterp/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T02:06:51Z","updated_at":"2015-07-16T02:06:51Z","body":"Rephrased and added detail in this new issue: #127 "}}