eval (Subscript t k) = do
  t' <- eval t
  k' <- eval k
  extract t' k'
  where
    -- Extract a value from the table with the given [key]
    extract (Table pairs) key = do
      let found = (filter (\(tk, tv) -> tk == key) pairs)
      if length found > 0 then
        return $ snd $ head found
      else
        return Nil
eval (Subscript t k) = do
  t' <- eval t
  k' <- eval k
  extract t' k'
  where
    -- Extract a value from the table with the given [key]
    extract (Table pairs) key = do
      let found = (filter (\(tk, tv) -> tk == key) pairs)
      if length found > 0 then
        return $ snd $ head found
      else
        return Nil
eval (Subscript t k) = do
  t' <- eval t
  k' <- eval k
  extract t' k'
  where
    -- Extract a value from the table with the given [key]
    extract (Table pairs) key = do
      let found = (filter (\(tk, tv) -> tk == key) pairs)
      if length found > 0 then
        return $ snd $ head found
      else
        return Nil