{"action":"opened","issue":{"url":"https://api.github.com/repos/sboosali/commands-core/issues/1","labels_url":"https://api.github.com/repos/sboosali/commands-core/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/sboosali/commands-core/issues/1/comments","events_url":"https://api.github.com/repos/sboosali/commands-core/issues/1/events","html_url":"https://github.com/sboosali/commands-core/issues/1","id":61926124,"number":1,"title":"remove partial function {wparser} from {Commands.Parse}","user":{"login":"sboosali","id":2320433,"avatar_url":"https://avatars.githubusercontent.com/u/2320433?v=3","gravatar_id":"","url":"https://api.github.com/users/sboosali","html_url":"https://github.com/sboosali","followers_url":"https://api.github.com/users/sboosali/followers","following_url":"https://api.github.com/users/sboosali/following{/other_user}","gists_url":"https://api.github.com/users/sboosali/gists{/gist_id}","starred_url":"https://api.github.com/users/sboosali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sboosali/subscriptions","organizations_url":"https://api.github.com/users/sboosali/orgs","repos_url":"https://api.github.com/users/sboosali/repos","events_url":"https://api.github.com/users/sboosali/events{/privacy}","received_events_url":"https://api.github.com/users/sboosali/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-16T00:18:08Z","updated_at":"2015-03-16T00:18:08Z","closed_at":null,"body":"the GADT:\r\n\r\n    data Symbol a where\r\n     Terminal    :: String -> Symbol String\r\n     NonTerminal :: a      -> Symbol a\r\n\r\nis type-safe:\r\n\r\n    generateParser :: Symbol a -> Parser a\r\n    generateParser (Terminal    s) = pure s\r\n    generateParser (NonTerminal a) = pure a\r\n\r\nbut can't be a Functor because:\r\n\r\n    fmap :: (a -> b) -> Symbol a -> Symbol b\r\n    fmap f (Terminal s) = undefined :: Symbol b\r\n    ...\r\n\r\nwe can neither apply, nor not need to apply, the function @f@.\r\n\r\n\r\nthe ADT:\r\n\r\n    data Symbol a\r\n     = Terminal    String\r\n     | NonTerminal a\r\n\r\nis a Functor:\r\n\r\n    deriving Functor\r\n\r\nbecause @Terminal@ is phantom wrt @Symbol a@ (is that how you say it?)\r\n\r\nbut not type-safe:\r\n\r\n    generateParser :: Symbol a -> Parser a\r\n    generateParser (Terminal s) = pure undefined :: Parser a\r\n    ...\r\n\r\n(types are simplified)"}}