{"action":"closed","issue":{"url":"https://api.github.com/repos/kcsongor/generic-lens/issues/73","repository_url":"https://api.github.com/repos/kcsongor/generic-lens","labels_url":"https://api.github.com/repos/kcsongor/generic-lens/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/kcsongor/generic-lens/issues/73/comments","events_url":"https://api.github.com/repos/kcsongor/generic-lens/issues/73/events","html_url":"https://github.com/kcsongor/generic-lens/issues/73","id":385672662,"node_id":"MDU6SXNzdWUzODU2NzI2NjI=","number":73,"title":"Unable to traverse with `types` if `Text` is present","user":{"login":"ShrykeWindgrace","id":6421233,"node_id":"MDQ6VXNlcjY0MjEyMzM=","avatar_url":"https://avatars1.githubusercontent.com/u/6421233?v=4","gravatar_id":"","url":"https://api.github.com/users/ShrykeWindgrace","html_url":"https://github.com/ShrykeWindgrace","followers_url":"https://api.github.com/users/ShrykeWindgrace/followers","following_url":"https://api.github.com/users/ShrykeWindgrace/following{/other_user}","gists_url":"https://api.github.com/users/ShrykeWindgrace/gists{/gist_id}","starred_url":"https://api.github.com/users/ShrykeWindgrace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShrykeWindgrace/subscriptions","organizations_url":"https://api.github.com/users/ShrykeWindgrace/orgs","repos_url":"https://api.github.com/users/ShrykeWindgrace/repos","events_url":"https://api.github.com/users/ShrykeWindgrace/events{/privacy}","received_events_url":"https://api.github.com/users/ShrykeWindgrace/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/kcsongor/generic-lens/milestones/3","html_url":"https://github.com/kcsongor/generic-lens/milestone/3","labels_url":"https://api.github.com/repos/kcsongor/generic-lens/milestones/3/labels","id":3868396,"node_id":"MDk6TWlsZXN0b25lMzg2ODM5Ng==","number":3,"title":"1.2.0.0","description":null,"creator":{"login":"kcsongor","id":313596,"node_id":"MDQ6VXNlcjMxMzU5Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/313596?v=4","gravatar_id":"","url":"https://api.github.com/users/kcsongor","html_url":"https://github.com/kcsongor","followers_url":"https://api.github.com/users/kcsongor/followers","following_url":"https://api.github.com/users/kcsongor/following{/other_user}","gists_url":"https://api.github.com/users/kcsongor/gists{/gist_id}","starred_url":"https://api.github.com/users/kcsongor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcsongor/subscriptions","organizations_url":"https://api.github.com/users/kcsongor/orgs","repos_url":"https://api.github.com/users/kcsongor/repos","events_url":"https://api.github.com/users/kcsongor/events{/privacy}","received_events_url":"https://api.github.com/users/kcsongor/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":4,"state":"open","created_at":"2018-12-03T23:03:23Z","updated_at":"2019-01-02T17:39:22Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2018-11-29T10:41:33Z","updated_at":"2019-01-02T17:39:22Z","closed_at":"2019-01-02T17:39:22Z","author_association":"NONE","body":"Hi, I was toying around with `types` traversal and observed a change of behaviour when I start using `Text` in my records.\r\n\r\nConsider this MWE (imports in cabal : `text, lens, generic-lens, generic-deriving`, with lts-12.20 and ghc-8.4.4):\r\n```\r\n{-# LANGUAGE DataKinds         #-}\r\n{-# LANGUAGE DeriveGeneric     #-}\r\n{-# LANGUAGE FlexibleContexts  #-}\r\n{-# LANGUAGE OverloadedStrings #-}\r\n{-# LANGUAGE TypeApplications  #-}\r\nmodule Main (main) where\r\nimport           Control.Lens.Fold\r\nimport           Data.Generics.Product.Types\r\nimport           Data.Text\r\nimport           GHC.Generics\r\n\r\nnewtype Name = Name Text deriving (Eq, Show, Generic)\r\n\r\ndata Description = N None | S Sirname | M Multiple deriving (Eq, Show, Generic)\r\n\r\ndata None = None deriving (Eq, Show, Generic)\r\n\r\ndata Sirname = Sirname {\r\n    honorific :: Text,\r\n    name      :: Name\r\n} deriving (Eq, Show, Generic)\r\n\r\ndata Multiple = Multiple {\r\n    descr  :: Text,\r\n    titles :: [(Text, [Description])]\r\n} deriving (Eq, Show, Generic )\r\n\r\n\r\nmain :: IO ()\r\nmain = \r\n    print $ toListOf (types @Name) person\r\n\r\n\r\n\r\nperson :: Description\r\nperson = M $ Multiple \"\" [\r\n    ( \"born\", [N None] ),\r\n    ( \"created\", [S $ Sirname \"sir\" (Name \"John\") ] ),\r\n    ( \"created\", [S $ Sirname \"duke of\" (Name \"Duchy\") ] )\r\n    ]\r\n\r\n```\r\nThe compilation fails with \r\n```\r\n    • No instance for (Data.Generics.Product.Types.HasTypes'\r\n                         (Data.Generics.Product.Types.Snd\r\n                            (Data.Generics.Product.Types.InterestingOr\r\n                               (Data.Generics.Product.Types.InterestingOr\r\n                                  (Data.Generics.Product.Types.Interesting'\r\n                                     (Rep Text) Name '[Text, Sirname, None, Description])\r\n                                  (M1\r\n                                     S\r\n                                     ('MetaSel\r\n                                        ('Just \"name\")\r\n                                        'NoSourceUnpackedness\r\n                                        'NoSourceStrictness\r\n                                        'DecidedLazy)\r\n                                     (Rec0 Name))\r\n                                  Name)\r\n                               (M1\r\n                                  C\r\n                                  ('MetaCons \"M\" 'PrefixI 'False)\r\n                                  (S1\r\n                                     ('MetaSel\r\n                                        'Nothing\r\n                                        'NoSourceUnpackedness\r\n                                        'NoSourceStrictness\r\n                                        'DecidedLazy)\r\n                                     (Rec0 Multiple)))\r\n                               Name))\r\n                         Description\r\n                         Name)\r\n        arising from a use of ‘types’\r\n    • In the first argument of ‘toListOf’, namely ‘(types @Name)’\r\n      In the second argument of ‘($)’, namely\r\n        ‘toListOf (types @Name) person’\r\n      In the expression: print $ toListOf (types @Name) person\r\n```\r\nHowever, if I replace all mentions of `Text` by `String`, the compilation goes well and the output is correct.\r\n\r\nHow do I circumvent this problem? "}}
{"actor":{"display_login":"kcsongor"}}