@ has joined the channel
import Data.Array main :: IO () main = do let m = listArray ((1,1),(10,10)) [i+j |i<-[1..10], j<-[1..10]] print $ minPath m ! (8,8) minPath :: Array (Int,Int) Int -> Array (Int,Int) Int minPath mat = listArray ((1,1),(10,10)) $ [ f i j | i<-[1..10], j<-[1..10]] where f 1 1 = mat ! (1,1) f 1 j = mat ! (1,j) + minPath mat ! (1,j-1) f i 1 = mat ! (i,1) + minPath mat ! (i-1,1) f i j = if minPath mat ! (i-1,j) > minPath mat ! (i,j-1) then minPath mat ! (i,j-1) + mat ! (i,j) else minPath mat ! (i-1,j) + mat ! (i,j)