{"action":"created","issue":{"url":"https://api.github.com/repos/vu3rdd/functorrent/issues/18","labels_url":"https://api.github.com/repos/vu3rdd/functorrent/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/vu3rdd/functorrent/issues/18/comments","events_url":"https://api.github.com/repos/vu3rdd/functorrent/issues/18/events","html_url":"https://github.com/vu3rdd/functorrent/issues/18","id":64831182,"number":18,"title":"Cleanup bytestring usage","user":{"login":"jaseemabid","id":601714,"avatar_url":"https://avatars.githubusercontent.com/u/601714?v=3","gravatar_id":"","url":"https://api.github.com/users/jaseemabid","html_url":"https://github.com/jaseemabid","followers_url":"https://api.github.com/users/jaseemabid/followers","following_url":"https://api.github.com/users/jaseemabid/following{/other_user}","gists_url":"https://api.github.com/users/jaseemabid/gists{/gist_id}","starred_url":"https://api.github.com/users/jaseemabid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaseemabid/subscriptions","organizations_url":"https://api.github.com/users/jaseemabid/orgs","repos_url":"https://api.github.com/users/jaseemabid/repos","events_url":"https://api.github.com/users/jaseemabid/events{/privacy}","received_events_url":"https://api.github.com/users/jaseemabid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-27T19:02:34Z","updated_at":"2015-03-27T19:07:24Z","closed_at":null,"body":"We use both lazy and strict version interchangeably everywhere. We need to stick to one. I have a feeling that the lazy version might work everywhere. \r\n\r\nSee http://blog.ezyang.com/2010/08/strings-in-haskell/ for some additional info. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/vu3rdd/functorrent/issues/comments/87059982","html_url":"https://github.com/vu3rdd/functorrent/issues/18#issuecomment-87059982","issue_url":"https://api.github.com/repos/vu3rdd/functorrent/issues/18","id":87059982,"user":{"login":"jaseemabid","id":601714,"avatar_url":"https://avatars.githubusercontent.com/u/601714?v=3","gravatar_id":"","url":"https://api.github.com/users/jaseemabid","html_url":"https://github.com/jaseemabid","followers_url":"https://api.github.com/users/jaseemabid/followers","following_url":"https://api.github.com/users/jaseemabid/following{/other_user}","gists_url":"https://api.github.com/users/jaseemabid/gists{/gist_id}","starred_url":"https://api.github.com/users/jaseemabid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaseemabid/subscriptions","organizations_url":"https://api.github.com/users/jaseemabid/orgs","repos_url":"https://api.github.com/users/jaseemabid/repos","events_url":"https://api.github.com/users/jaseemabid/events{/privacy}","received_events_url":"https://api.github.com/users/jaseemabid/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T19:07:24Z","updated_at":"2015-03-27T19:07:24Z","body":"Example: \r\n    \r\n    handShakeMsg :: InfoDict -> String -> ByteString\r\n    handShakeMsg m peer_id = let pstrlen = concat $ toChunks $ Bin.encode (19 :: Int8)\r\n                                 pstr = pack \"BitTorrent protocol\"\r\n                                 reserved = replicate 8 '\\0'\r\n                                 infoH = infoHash m\r\n                                 peerID = pack peer_id\r\n                             in concat [pstrlen, pstr, reserved, infoH, peerID]\r\n\r\n\r\n`Bin.encode` returns the lazy version, and `concat . toChunks` makes it strict.\r\nThis might be unnecessary.\r\n\r\nRef: http://stackoverflow.com/questions/1451755/many-types-of-string-bytestring"}}