{"action":"opened","issue":{"url":"https://api.github.com/repos/oisdk/semiring-num/issues/1","repository_url":"https://api.github.com/repos/oisdk/semiring-num","labels_url":"https://api.github.com/repos/oisdk/semiring-num/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/oisdk/semiring-num/issues/1/comments","events_url":"https://api.github.com/repos/oisdk/semiring-num/issues/1/events","html_url":"https://github.com/oisdk/semiring-num/issues/1","id":376959349,"node_id":"MDU6SXNzdWUzNzY5NTkzNDk=","number":1,"title":"Finite map as semiring?","user":{"login":"conal","id":399103,"node_id":"MDQ6VXNlcjM5OTEwMw==","avatar_url":"https://avatars0.githubusercontent.com/u/399103?v=4","gravatar_id":"","url":"https://api.github.com/users/conal","html_url":"https://github.com/conal","followers_url":"https://api.github.com/users/conal/followers","following_url":"https://api.github.com/users/conal/following{/other_user}","gists_url":"https://api.github.com/users/conal/gists{/gist_id}","starred_url":"https://api.github.com/users/conal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conal/subscriptions","organizations_url":"https://api.github.com/users/conal/orgs","repos_url":"https://api.github.com/users/conal/repos","events_url":"https://api.github.com/users/conal/events{/privacy}","received_events_url":"https://api.github.com/users/conal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-02T20:37:00Z","updated_at":"2018-11-02T20:37:00Z","closed_at":null,"author_association":"NONE","body":"\r\nHow did you choose the following `Semiring` instance for finite maps?\r\n\r\n``` haskell\r\ninstance (Ord a, Monoid a, Semiring b) =>\r\n         Semiring (Map a b) where\r\n    one = Map.singleton mempty one\r\n    {-# INLINE one #-}\r\n    zero = Map.empty\r\n    {-# INLINE zero #-}\r\n    (<+>) = Map.unionWith (<+>)\r\n    {-# INLINE (<+>) #-}\r\n    xs <.> ys =\r\n        Map.fromListWith\r\n            (<+>)\r\n            [ (mappend k l, v <.> u)\r\n            | (k,v) <- Map.toList xs\r\n            , (l,u) <- Map.toList ys ]\r\n    {-# INLINE (<.>) #-}\r\n```\r\n\r\nIt seems to suit languages as bags of strings (and other monoidal values), generalized from natural numbers as multiplicities.\r\n"}}
{"actor":{"display_login":"conal"}}