 
   # Returns the coordinate of the last square starting from `coord` and going
   # in `direction` that is not an anchor (nor off the board).
-  @spec scan_to_anchor(Grid.t, Grid.cood, direction) :: Grid.coord
-  defp scan_to_anchor(grid, coord, direction) do
+  @spec scan_to_anchor(Grid.t, Grid.coord, cardinal_direction | direction) :: Grid.coord
+  def scan_to_anchor(grid, coord, direction) do
     next_coord = next_coord(coord, direction)
 
     cond do


  defp do_letters_with_coords(acc, _, [], _), do: Enum.reverse(acc)

  @spec next_coord(Grid.coord, direction) :: Grid.coord
  defp next_coord(coord, direction)
  defp next_coord({row, col}, :across), do: {row, col + 1}
  defp next_coord({row, col}, :down), do: {row + 1, col}

  # Returns the coordinate of the last square starting from `coord` and going
  # in `direction` that is a letter.
  @spec scan_letters(Grid.t, Grid.coord, direction) :: Grid.coord
  defp scan_letters(grid, coord, direction) do
    next_coord = next_coord(coord, direction)
    next_square = Map.get(grid, next_coord)


  alias LexibombServer.Board.Square
  alias LexibombServer.Rack

  @type cardinal_direction :: :n | :e | :s | :w
  @type direction :: :across | :down
  @type t :: %{
    start: Board.coord,
