Skip to content

Instantly share code, notes, and snippets.

@expipiplus1
Created October 21, 2016 09:53
Show Gist options
  • Save expipiplus1/1da20d12f653287f78688ef37844e8f8 to your computer and use it in GitHub Desktop.
Save expipiplus1/1da20d12f653287f78688ef37844e8f8 to your computer and use it in GitHub Desktop.
import Control.Monad (replicateM)
-- | Read an integer, n, on one line and read n values on subsequent lines
readCount :: Read a => IO [a]
readCount = do
n <- readLn
replicateM n readLn
main = do
ints <- readCount
print (sum ints)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment