{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/956","labels_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/956/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/956/comments","events_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/956/events","html_url":"https://github.com/elm-lang/elm-compiler/issues/956","id":83757818,"number":956,"title":"Stack overflow with incorrect polymorphic types","user":{"login":"mkolosick","id":5940852,"avatar_url":"https://avatars.githubusercontent.com/u/5940852?v=3","gravatar_id":"","url":"https://api.github.com/users/mkolosick","html_url":"https://github.com/mkolosick","followers_url":"https://api.github.com/users/mkolosick/followers","following_url":"https://api.github.com/users/mkolosick/following{/other_user}","gists_url":"https://api.github.com/users/mkolosick/gists{/gist_id}","starred_url":"https://api.github.com/users/mkolosick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkolosick/subscriptions","organizations_url":"https://api.github.com/users/mkolosick/orgs","repos_url":"https://api.github.com/users/mkolosick/repos","events_url":"https://api.github.com/users/mkolosick/events{/privacy}","received_events_url":"https://api.github.com/users/mkolosick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-02T00:19:07Z","updated_at":"2015-06-02T00:50:36Z","closed_at":null,"body":"```Elm\r\nimport Array exposing (Array)\r\n\r\ntype alias Focus big small =\r\n    { get : big -> small\r\n    , update : (small -> small) -> big -> big\r\n    }\r\n\r\ncreate : (big -> small) -> ((small -> small) -> big -> big) -> Focus big small\r\ncreate get update =\r\n    { get=get, update=update }\r\n    \r\narrayFocus : Int -> Focus (Array a) a\r\narrayFocus index = create (Array.get index) (arrayUpdate index)\r\n\r\narrayUpdate : Int -> (a -> a) -> Array a -> Array a\r\narrayUpdate index f array =\r\n  case Array.get index array of\r\n    Just val -> Array.set index (f val) array\r\n```\r\n\r\nCauses a stack overflow because of the `arrayFocus` function. `create` is provided arguments of type `Array a -> Maybe a` and `(a -> a) -> Array a -> Array a` instead of `Array a -> a` and `(a -> a) -> Array a -> Array a`"},"comment":{"url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/comments/107757448","html_url":"https://github.com/elm-lang/elm-compiler/issues/956#issuecomment-107757448","issue_url":"https://api.github.com/repos/elm-lang/elm-compiler/issues/956","id":107757448,"user":{"login":"mkolosick","id":5940852,"avatar_url":"https://avatars.githubusercontent.com/u/5940852?v=3","gravatar_id":"","url":"https://api.github.com/users/mkolosick","html_url":"https://github.com/mkolosick","followers_url":"https://api.github.com/users/mkolosick/followers","following_url":"https://api.github.com/users/mkolosick/following{/other_user}","gists_url":"https://api.github.com/users/mkolosick/gists{/gist_id}","starred_url":"https://api.github.com/users/mkolosick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkolosick/subscriptions","organizations_url":"https://api.github.com/users/mkolosick/orgs","repos_url":"https://api.github.com/users/mkolosick/repos","events_url":"https://api.github.com/users/mkolosick/events{/privacy}","received_events_url":"https://api.github.com/users/mkolosick/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T00:50:36Z","updated_at":"2015-06-02T00:50:36Z","body":"If you remove `create` you get\r\n```\r\nType mismatch between the following types on line 9, column 22 to 75:\r\n\r\n        a\r\n\r\n        Maybe.Maybe a\r\n\r\n    Could not unify rigid type variable 'a'.\r\nThe problem probably relates to the type variable being shared between a\r\ntop-level type annotation and a related let-bound type annotation.\r\n    It is related to the following expression:\r\n\r\n        { get = Array.get index, update = arrayUpdate index }\r\n```"}}