Duas memoizações de parâmetro em Haskell

Estou tentando memorizar a seguinte função:

gridwalk x y
    | x == 0 = 1
    | y == 0 = 1
    | otherwise = (gridwalk (x - 1) y) + (gridwalk x (y - 1))

Olhando paraist Eu vim com a seguinte solução:

gw :: (Int -> Int -> Int) -> Int -> Int -> Int
gw f x y
    | x == 0 = 1
    | y == 0 = 1
    | otherwise = (f (x - 1) y) + (f x (y - 1))

gwlist :: [Int]
gwlist = map (\i -> gw fastgw (i `mod` 20) (i `div` 20)) [0..]

fastgw :: Int -> Int -> Int
fastgw x y = gwlist !! (x + y * 20)

Que eu posso chamar assim:

gw fastgw 20 20

Existe uma maneira mais fácil, concisa e geral (observe como tive que codificar as dimensões máximas da grade nogwlist para converter do espaço 2D para 1D para que eu possa acessar a lista de memorização) para memorizar funções com vários parâmetros no Haskel

questionAnswers(4)

yourAnswerToTheQuestion