{"action":"created","issue":{"url":"https://api.github.com/repos/fumieval/objective/issues/13","repository_url":"https://api.github.com/repos/fumieval/objective","labels_url":"https://api.github.com/repos/fumieval/objective/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/fumieval/objective/issues/13/comments","events_url":"https://api.github.com/repos/fumieval/objective/issues/13/events","html_url":"https://github.com/fumieval/objective/issues/13","id":294282664,"number":13,"title":"instance Category Object","user":{"login":"Icelandjack","id":501899,"avatar_url":"https://avatars3.githubusercontent.com/u/501899?v=4","gravatar_id":"","url":"https://api.github.com/users/Icelandjack","html_url":"https://github.com/Icelandjack","followers_url":"https://api.github.com/users/Icelandjack/followers","following_url":"https://api.github.com/users/Icelandjack/following{/other_user}","gists_url":"https://api.github.com/users/Icelandjack/gists{/gist_id}","starred_url":"https://api.github.com/users/Icelandjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Icelandjack/subscriptions","organizations_url":"https://api.github.com/users/Icelandjack/orgs","repos_url":"https://api.github.com/users/Icelandjack/repos","events_url":"https://api.github.com/users/Icelandjack/events{/privacy}","received_events_url":"https://api.github.com/users/Icelandjack/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-05T06:02:05Z","updated_at":"2018-02-06T11:04:48Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"You can implement a `Category Object` if you add `Coyoneda`s to the `Object` to get rid of the `Functor` constraint, maybe you find it useful\r\n\r\n```haskell\r\nnewtype Object :: (Type -> Type) -> (Type -> Type) -> Type where\r\n  Object :: (forall xx. Coyoneda f xx -> Coyoneda g (xx, Object f g)) -> Object f g\r\n\r\ninstance Category Object where\r\n  id :: Object f f\r\n  id = Object (\\a -> fmap (, id) a)\r\n\r\n  (.) :: Object b c -> Object a b -> Object a c\r\n  Object obj' . Object obj = Object (fmap (\\((x, ab), bc) -> (x, bc . ab)) . obj' . obj)\r\n```"},"comment":{"url":"https://api.github.com/repos/fumieval/objective/issues/comments/363389107","html_url":"https://github.com/fumieval/objective/issues/13#issuecomment-363389107","issue_url":"https://api.github.com/repos/fumieval/objective/issues/13","id":363389107,"user":{"login":"Icelandjack","id":501899,"avatar_url":"https://avatars3.githubusercontent.com/u/501899?v=4","gravatar_id":"","url":"https://api.github.com/users/Icelandjack","html_url":"https://github.com/Icelandjack","followers_url":"https://api.github.com/users/Icelandjack/followers","following_url":"https://api.github.com/users/Icelandjack/following{/other_user}","gists_url":"https://api.github.com/users/Icelandjack/gists{/gist_id}","starred_url":"https://api.github.com/users/Icelandjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Icelandjack/subscriptions","organizations_url":"https://api.github.com/users/Icelandjack/orgs","repos_url":"https://api.github.com/users/Icelandjack/repos","events_url":"https://api.github.com/users/Icelandjack/events{/privacy}","received_events_url":"https://api.github.com/users/Icelandjack/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T11:04:48Z","updated_at":"2018-02-06T11:04:48Z","author_association":"CONTRIBUTOR","body":"One possibility:\r\n\r\nDefine the ‘default’ `Object` (with `Coyoneda`) and an isomorphic `Obj` type (without `Coyoneda`)\r\n\r\n```haskell\r\nnewtype Object f g = Object_ (forall xx. Coyoneda f xx -> Coyoneda g (xx, Object f g))\r\nnewtype Obj    f g = Obj     (forall xx. f xx -> g (xx, Obj f g))\r\n\r\ntoObj :: Functor g => Object f g -> Obj f g\r\ntoObj (Object_ obj) = Obj (lowerCoyoneda . obj . liftCoyoneda)\r\n\r\nfromObj :: Functor f => Obj f g -> Object f g\r\nfromObj (Obj obj') = Object_ (liftCoyoneda . obj' . lowerCoyoneda)\r\n```\r\n\r\nThen define a `-XPatternSynonym`\r\n\r\n```haskell\r\npattern Object :: (Functor f, Functor g) => (forall xx. f xx -> g (xx, Object f g)) -> Object f g\r\npattern Object obj <- (toObj -> Obj obj)\r\n  where Object obj = fromObj (Obj obj)\r\n```\r\n"}}
{"actor":{"display_login":"Icelandjack"}}