How can I access a list by index in Haskell, analog to this C code?
int a[] = { 34, 45, 56 }; return a[1];
You can use !!, but if you want to do it recursively then below is one way to do it:
!!
dataAt :: Int -> [a] -> a dataAt _ [] = error "Empty List!" dataAt y (x:xs) | y <= 0 = x | otherwise = dataAt (y-1) xs