{"action":"opened","issue":{"url":"https://api.github.com/repos/DanBurton/rev-state/issues/2","labels_url":"https://api.github.com/repos/DanBurton/rev-state/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/DanBurton/rev-state/issues/2/comments","events_url":"https://api.github.com/repos/DanBurton/rev-state/issues/2/events","html_url":"https://github.com/DanBurton/rev-state/issues/2","id":122247724,"number":2,"title":"`MonadFix` instance is needlessly strict","user":{"login":"gergoerdi","id":116009,"avatar_url":"https://avatars.githubusercontent.com/u/116009?v=3","gravatar_id":"","url":"https://api.github.com/users/gergoerdi","html_url":"https://github.com/gergoerdi","followers_url":"https://api.github.com/users/gergoerdi/followers","following_url":"https://api.github.com/users/gergoerdi/following{/other_user}","gists_url":"https://api.github.com/users/gergoerdi/gists{/gist_id}","starred_url":"https://api.github.com/users/gergoerdi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gergoerdi/subscriptions","organizations_url":"https://api.github.com/users/gergoerdi/orgs","repos_url":"https://api.github.com/users/gergoerdi/repos","events_url":"https://api.github.com/users/gergoerdi/events{/privacy}","received_events_url":"https://api.github.com/users/gergoerdi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-15T11:05:27Z","updated_at":"2015-12-15T11:05:27Z","closed_at":null,"body":"As explained on http://stackoverflow.com/a/34287498/477476 , `RevState`'s `MonadFix` instance is too strict and is practically unusable as a result. The fix is a trivial matter of using an irrefutable pattern in the instance definition; i.e. going from\r\n\r\n```\r\ninstance MonadFix m => MonadFix (StateT s m) where\r\n  mfix f = StateT $ \\s -> mfix (\\(x, _) -> runStateT (f x) s)\r\n```\r\n\r\nto\r\n\r\n```\r\ninstance MonadFix m => MonadFix (StateT s m) where\r\n  mfix f = StateT $ \\s -> mfix (\\ ~(x, _) -> runStateT (f x) s)\r\n```"}}