Project Euler Problem 022
import Control.Monad import Data.Char import Data.List import System.IO.Unsafe filedata :: String filedata = unsafePerformIO $ readFile "022names.txt" strs :: [String] strs = sort ((read ("[" ++ filedata ++ "]")) :: [String]) numbered :: [(String, Int)] numbered = zip strs [1..] score :: [Char] -> Int score str = sum (map ((+1) . (subtract (ord 'A')) . ord) str) ans1 :: Int ans1 = sum $ map (\(s,num) -> num * score s) numbered -- 871198282 main :: IO () main = print ans1