{"action":"created","issue":{"url":"https://api.github.com/repos/alpmestan/regress/issues/1","repository_url":"https://api.github.com/repos/alpmestan/regress","labels_url":"https://api.github.com/repos/alpmestan/regress/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/alpmestan/regress/issues/1/comments","events_url":"https://api.github.com/repos/alpmestan/regress/issues/1/events","html_url":"https://github.com/alpmestan/regress/issues/1","id":138755034,"number":1,"title":"Definition of 'dot' function","user":{"login":"Alaya-in-Matrix","id":8230801,"avatar_url":"https://avatars.githubusercontent.com/u/8230801?v=3","gravatar_id":"","url":"https://api.github.com/users/Alaya-in-Matrix","html_url":"https://github.com/Alaya-in-Matrix","followers_url":"https://api.github.com/users/Alaya-in-Matrix/followers","following_url":"https://api.github.com/users/Alaya-in-Matrix/following{/other_user}","gists_url":"https://api.github.com/users/Alaya-in-Matrix/gists{/gist_id}","starred_url":"https://api.github.com/users/Alaya-in-Matrix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alaya-in-Matrix/subscriptions","organizations_url":"https://api.github.com/users/Alaya-in-Matrix/orgs","repos_url":"https://api.github.com/users/Alaya-in-Matrix/repos","events_url":"https://api.github.com/users/Alaya-in-Matrix/events{/privacy}","received_events_url":"https://api.github.com/users/Alaya-in-Matrix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-06T04:55:26Z","updated_at":"2016-03-06T09:37:26Z","closed_at":null,"body":"Is the `dot` function defined to produce the dot product?\r\n\r\nSeems that it does not give dot product\r\n\r\nfor example `dot [1,2] [1,2]` would give 9 instead of `5 = 1 * 1 + 2 *2`\r\n\r\nPerhaps a workaround like this\r\n\r\n```haskell\r\ndot :: (Applicative v, Foldable v, Num a)\r\n    => v a\r\n    -> v a\r\n    -> a\r\ndot x y = sum $ zipWith (*) xs ys\r\n    where xs = toList x\r\n          ys = toList y\r\n-- dot x y = getSum . foldMap Sum $ liftA2 (*) x y\r\n```"},"comment":{"url":"https://api.github.com/repos/alpmestan/regress/issues/comments/192851323","html_url":"https://github.com/alpmestan/regress/issues/1#issuecomment-192851323","issue_url":"https://api.github.com/repos/alpmestan/regress/issues/1","id":192851323,"user":{"login":"alpmestan","id":119323,"avatar_url":"https://avatars.githubusercontent.com/u/119323?v=3","gravatar_id":"","url":"https://api.github.com/users/alpmestan","html_url":"https://github.com/alpmestan","followers_url":"https://api.github.com/users/alpmestan/followers","following_url":"https://api.github.com/users/alpmestan/following{/other_user}","gists_url":"https://api.github.com/users/alpmestan/gists{/gist_id}","starred_url":"https://api.github.com/users/alpmestan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpmestan/subscriptions","organizations_url":"https://api.github.com/users/alpmestan/orgs","repos_url":"https://api.github.com/users/alpmestan/repos","events_url":"https://api.github.com/users/alpmestan/events{/privacy}","received_events_url":"https://api.github.com/users/alpmestan/received_events","type":"User","site_admin":false},"created_at":"2016-03-06T09:37:26Z","updated_at":"2016-03-06T09:37:26Z","body":"Right, I have mostly been using vectors where the `Applicative` instance does \"the right thing\". It's however quite wrong to rely on  Applicative` here. You either have to use `ZipList` or any container that has a \"zippy\" `Applicative` for the code to behave correctly at the moment. OTOH, it's a bit unfortunate to convert to list in your proposed definition.\r\n\r\nWasn't there a class in some package to express exactly this `zipWith` operation? If not, I could provide one along with well-behaved instances for all the standard containers.\r\n\r\nSorry for the inconvenience, this package was initially a bit of an experiment and hasn't seen a lot of love lately."}}