Skip to content

Instantly share code, notes, and snippets.

@xenophobia
Created September 30, 2012 13:52
Show Gist options
  • Save xenophobia/3806786 to your computer and use it in GitHub Desktop.
Save xenophobia/3806786 to your computer and use it in GitHub Desktop.
import Data.Array.IArray
sumA :: Array Int Int -> Int
sumA ary = foldl (\acc i -> acc + ary!i) 0 (indices ary)
main = do
let ary = listArray (1, 10) [1..] :: Array Int Int
print $ sumA ary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment