{"action":"created","issue":{"url":"https://api.github.com/repos/yihuang/tagstream-conduit/issues/18","repository_url":"https://api.github.com/repos/yihuang/tagstream-conduit","labels_url":"https://api.github.com/repos/yihuang/tagstream-conduit/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/yihuang/tagstream-conduit/issues/18/comments","events_url":"https://api.github.com/repos/yihuang/tagstream-conduit/issues/18/events","html_url":"https://github.com/yihuang/tagstream-conduit/pull/18","id":153352254,"number":18,"title":"Demonstration of how to Backpack'ify this package.","user":{"login":"ezyang","id":13564,"avatar_url":"https://avatars.githubusercontent.com/u/13564?v=3","gravatar_id":"","url":"https://api.github.com/users/ezyang","html_url":"https://github.com/ezyang","followers_url":"https://api.github.com/users/ezyang/followers","following_url":"https://api.github.com/users/ezyang/following{/other_user}","gists_url":"https://api.github.com/users/ezyang/gists{/gist_id}","starred_url":"https://api.github.com/users/ezyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezyang/subscriptions","organizations_url":"https://api.github.com/users/ezyang/orgs","repos_url":"https://api.github.com/users/ezyang/repos","events_url":"https://api.github.com/users/ezyang/events{/privacy}","received_events_url":"https://api.github.com/users/ezyang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-06T00:01:59Z","updated_at":"2016-05-08T10:43:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yihuang/tagstream-conduit/pulls/18","html_url":"https://github.com/yihuang/tagstream-conduit/pull/18","diff_url":"https://github.com/yihuang/tagstream-conduit/pull/18.diff","patch_url":"https://github.com/yihuang/tagstream-conduit/pull/18.patch"},"body":"In this Reddit thread\r\nhttps://www.reddit.com/r/haskell/comments/28v6c9/backpack_an_mllike_module_system_for_haskell/cif36ed\r\n@chrisdone mentioned tagstream-conduit as an example of a place where\r\nlack of parametrized modules made it a bit annoying to write\r\nentity parsing code that worked for both Text and ByteString.\r\n\r\nIn this commit, I give a refactoring of tagstream-conduit which\r\nuses Backpack to handle parametrization. The key component,\r\nentities/Entities.hs, is parametrized over the\r\ntype of String, Builder and Parser you want to use.  This\r\neliminates the duplication between Text/HTML/TagStream/ByteString.hs\r\nand Text/HTML/TagStream/Text.hs, which are now just reexports of\r\nappropriately instantiated versions of Entities.\r\n\r\nThere are three internal libraries:\r\n\r\n    - 'types' defines common data types and \"shim\" modules for\r\n      ByteString and Text.  (If I can convince text/bytestring\r\n      to standardize naming for all their functions, I can\r\n      reduce/eliminate these shim modules.)\r\n    - 'entities' is the parametrized component, parametrized\r\n      over the Str, Builder and Parser modules (the signatures\r\n      required for these modules are in the hsig files.)\r\n    - 'tagstream-conduit' is the main library and exposes the\r\n      same outward facing interface as the old library.\r\n\r\nPlease take a look at the refactoring and let me know how you\r\nlike it; unfortunately, you'll need my development branches of\r\nCabal and GHC to actually build this package. In\r\nparticular, supposing that Backpack was supported on all\r\nthe versions of GHC/Cabal you wanted to target, would you\r\nuse this? What do you like/dislike about the system?\r\n\r\nSigned-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>"},"comment":{"url":"https://api.github.com/repos/yihuang/tagstream-conduit/issues/comments/217708727","html_url":"https://github.com/yihuang/tagstream-conduit/pull/18#issuecomment-217708727","issue_url":"https://api.github.com/repos/yihuang/tagstream-conduit/issues/18","id":217708727,"user":{"login":"yihuang","id":236070,"avatar_url":"https://avatars.githubusercontent.com/u/236070?v=3","gravatar_id":"","url":"https://api.github.com/users/yihuang","html_url":"https://github.com/yihuang","followers_url":"https://api.github.com/users/yihuang/followers","following_url":"https://api.github.com/users/yihuang/following{/other_user}","gists_url":"https://api.github.com/users/yihuang/gists{/gist_id}","starred_url":"https://api.github.com/users/yihuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yihuang/subscriptions","organizations_url":"https://api.github.com/users/yihuang/orgs","repos_url":"https://api.github.com/users/yihuang/repos","events_url":"https://api.github.com/users/yihuang/events{/privacy}","received_events_url":"https://api.github.com/users/yihuang/received_events","type":"User","site_admin":false},"created_at":"2016-05-08T10:43:43Z","updated_at":"2016-05-08T10:43:43Z","body":"Thanks for your efforts, it looks interesting, but I guess I need to know more about backpack to comment.\r\nDo you expect to merge this into master and release on hackage now? Or it's just experimental."}}