edtable :: (Eq a) => [a] -> [a] -> Array (Int, Int) (Cell a)
edtable v w =
    let res = array ((0,0), (length v , length w)) $
              [((0,0), Val 0 [Init])] ++
              [((x,0), Val x [X vx]) | (x,vx) <- zip [1..] v] ++
              [((0,y), Val y [Y wy]) | (y,wy) <- zip [1..] w] ++
              [((x,y), k)
              | (x,vx) <- zip [1..] v
              , (y,wy) <- zip [1..] w
              , let nx = 1 + val (res ! (x-1, y))
                    ny = 1 + val (res ! (x, y-1))
                    nd = (if vx == wy then 0 else 1) + val(res ! (x-1, y-1))
                    n  = minimum [nx, ny, nd]
              , let k = Val n $
                        [X vx | n == nx] ++
                        [Y wy | n == ny] ++
                        [Eq vx | n == nd, vx == wy] ++
                        [Neq vx | n == nd, vx /= wy]
              ]
    in res
edtable :: (Eq a) => [a] -> [a] -> Array (Int, Int) (Cell a)
edtable v w =
    let res = array ((0,0), (length v , length w)) $
              [((0,0), Val 0 [Init])] ++
              [((x,0), Val x [X vx]) | (x,vx) <- zip [1..] v] ++
              [((0,y), Val y [Y wy]) | (y,wy) <- zip [1..] w] ++
              [((x,y), k)
              | (x,vx) <- zip [1..] v
              , (y,wy) <- zip [1..] w
              , let nx = 1 + val (res ! (x-1, y))
                    ny = 1 + val (res ! (x, y-1))
                    nd = (if vx == wy then 0 else 1) + val(res ! (x-1, y-1))
                    n  = minimum [nx, ny, nd]
              , let k = Val n $
                        [X vx | n == nx] ++
                        [Y wy | n == ny] ++
                        [Eq vx | n == nd, vx == wy] ++
                        [Neq vx | n == nd, vx /= wy]
              ]
    in res
edtable v w =
    let res = array ((0,0), (length v , length w)) $
              [((0,0), Val 0 [Init])] ++
              [((x,0), Val x [X vx]) | (x,vx) <- zip [1..] v] ++
              [((0,y), Val y [Y wy]) | (y,wy) <- zip [1..] w] ++
              [((x,y), k)
              | (x,vx) <- zip [1..] v
              , (y,wy) <- zip [1..] w
              , let nx = 1 + val (res ! (x-1, y))
                    ny = 1 + val (res ! (x, y-1))
                    nd = (if vx == wy then 0 else 1) + val(res ! (x-1, y-1))
                    n  = minimum [nx, ny, nd]
              , let k = Val n $
                        [X vx | n == nx] ++
                        [Y wy | n == ny] ++
                        [Eq vx | n == nd, vx == wy] ++
                        [Neq vx | n == nd, vx /= wy]
              ]
    in res