{"action":"closed","issue":{"url":"https://api.github.com/repos/ekmett/contravariant/issues/29","repository_url":"https://api.github.com/repos/ekmett/contravariant","labels_url":"https://api.github.com/repos/ekmett/contravariant/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/ekmett/contravariant/issues/29/comments","events_url":"https://api.github.com/repos/ekmett/contravariant/issues/29/events","html_url":"https://github.com/ekmett/contravariant/issues/29","id":187531732,"number":29,"title":"Add 'Invariant' functor","user":{"login":"ChShersh","id":4276606,"avatar_url":"https://avatars.githubusercontent.com/u/4276606?v=3","gravatar_id":"","url":"https://api.github.com/users/ChShersh","html_url":"https://github.com/ChShersh","followers_url":"https://api.github.com/users/ChShersh/followers","following_url":"https://api.github.com/users/ChShersh/following{/other_user}","gists_url":"https://api.github.com/users/ChShersh/gists{/gist_id}","starred_url":"https://api.github.com/users/ChShersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChShersh/subscriptions","organizations_url":"https://api.github.com/users/ChShersh/orgs","repos_url":"https://api.github.com/users/ChShersh/repos","events_url":"https://api.github.com/users/ChShersh/events{/privacy}","received_events_url":"https://api.github.com/users/ChShersh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-05T23:51:41Z","updated_at":"2016-11-05T23:57:32Z","closed_at":"2016-11-05T23:57:32Z","body":"It may be useful to have this type class that corresponds to _invariant functors_:\r\n\r\n```haskell\r\nclass Invariant f where\r\n    invmap :: (b -> a) -> (a -> b) -> f a -> f b\r\n```\r\n\r\nObviously most useful instance would be for `Endo a`. Because `Endo a` can't be neither `Functor` nor `Contravariant` and even not `Profunctor`. But sometimes it is desirable to have some sort of mapping on `Endo`. But of course I expect other applications of `Invariant`. Probably it is a good idea to create separate `invariant` package for this purpose. And at current moment I don't expect it to be more than 20 lines or something like that.\r\n\r\nCareful reader may notice that `invmap` type is very similar to `Iso` from [lens](https://github.com/ekmett/lens) but lifted to some `*functor`. And even some laws are true for `Invariant`:\r\n\r\n```\r\ninvmap id id = id\r\ninvmap f g . invmap g f = id\r\n```\r\n\r\nMaybe this fact can be used somehow or there already exist similar abstraction. But I'm not aware of it."}}
{"actor":{"display_login":"RyanGlScott"}}