diff options
Diffstat (limited to 'lec07')
| -rw-r--r-- | lec07/Scrabble.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lec07/Scrabble.hs b/lec07/Scrabble.hs index 2c3b1f9..b0b34f9 100644 --- a/lec07/Scrabble.hs +++ b/lec07/Scrabble.hs @@ -1,6 +1,6 @@ module Scrabble where import Data.Char -import Data.List ((!?)) +import Data.List -- Exercise 3 @@ -15,7 +15,7 @@ instance Monoid Score where mempty = Score 0 score :: Char -> Score -score c = Score $ fromMaybe 0 $ scores !? (fromEnum (toUpper c) - fromEnum 'A') +score c = Score $ fromMaybe 0 $ (!?) scores $ fromEnum (toUpper c) - fromEnum 'A' where scores = [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10] :: [Int] scoreString :: String -> Score |