### TDD Game: sum

Code
Diff
• ``````module Sum (Sum.sum) where

import Prelude hiding (sum)

sum xs | null xs = 0 | otherwise = foldr1 (+) xs``````
• module Sum (Sum.sum) where
• import Prelude hiding (sum)
• sum :: (Foldable t) => t Word -> Word
• sum xs | null xs = 0 | otherwise = foldr1 (+) xs

### TDD Game: sum

Code
Diff
• ``````module Sum (Sum.sum) where

import Prelude hiding (sum)

sum :: (Foldable t, Num a) => t a -> a
sum xs | null xs = 0 | otherwise = foldr1 (+) xs``````
• module Sum (Sum.sum) where
• import Prelude hiding (sum)
• sum :: (Foldable t) => t Word -> Word
• sum :: (Foldable t, Num a) => t a -> a
• sum xs | null xs = 0 | otherwise = foldr1 (+) xs

### TDD Game: sum

Code
Diff
• ``````module Sum (Sum.sum) where

import Prelude hiding (sum)

sum :: (Foldable t, Integral a) => t a -> a
sum xs | null xs = 0 | otherwise = foldr1 (+) xs``````
• module Sum (Sum.sum) where
• import Prelude hiding (sum)
• sum :: (Foldable t) => t Word -> Word
• sum :: (Foldable t, Integral a) => t a -> a
• sum xs | null xs = 0 | otherwise = foldr1 (+) xs

### TDD Game: sum

Code
Diff
• ``````module Sum (Sum.sum) where

import Prelude hiding (sum)

sum :: (Foldable t) => t Integer -> Integer
sum xs | null xs = 0 | otherwise = foldr1 (+) xs``````
• module Sum (Sum.sum) where
• import Prelude hiding (sum)
• sum :: (Foldable t) => t Word -> Word
• sum :: (Foldable t) => t Integer -> Integer
• sum xs | null xs = 0 | otherwise = foldr1 (+) xs

### TDD Game: sum

Code
Diff
• ``````module Sum (Sum.sum) where

import Prelude hiding (sum)

sum :: Foldable t => t Word -> Word
sum xs | null xs = 0 | otherwise = foldr1 (+) xs``````
• module Sum (Sum.sum) where
• import Prelude hiding (sum)
• sum :: [Word] -> Word
• sum :: Foldable t => t Word -> Word
• sum xs | null xs = 0 | otherwise = foldr1 (+) xs