Fix product implementation
This commit is contained in:
+2
-2
@@ -18,7 +18,7 @@ import Data.Function ((.))
|
|||||||
import Data.Functor (fmap)
|
import Data.Functor (fmap)
|
||||||
import Control.Monad (return)
|
import Control.Monad (return)
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import GHC.Num (Num, (+))
|
import GHC.Num (Num, (+), (*))
|
||||||
|
|
||||||
head :: (Foldable f) => f a -> Maybe a
|
head :: (Foldable f) => f a -> Maybe a
|
||||||
head = foldr (\x _ -> return x) Nothing
|
head = foldr (\x _ -> return x) Nothing
|
||||||
@@ -43,7 +43,7 @@ list def f xs = case xs of
|
|||||||
|
|
||||||
{-# INLINE product #-}
|
{-# INLINE product #-}
|
||||||
product :: (Foldable f, Num a) => f a -> a
|
product :: (Foldable f, Num a) => f a -> a
|
||||||
product = foldl' (+) 1
|
product = foldl' (*) 1
|
||||||
|
|
||||||
{-# INLINE sum #-}
|
{-# INLINE sum #-}
|
||||||
sum :: (Foldable f, Num a) => f a -> a
|
sum :: (Foldable f, Num a) => f a -> a
|
||||||
|
|||||||
Reference in New Issue
Block a user