 defprotocol WebForm.Input do
-  def take(data, key, map)
+  def take(field, mount, map)
+
+  def check_blank(field, raw)
 end
 
 defmodule WebForm.Input.Text do

defimpl WebForm.Input, for: WebForm.Input.Text do
  def take(self, key, map) do
    {:ok, raw} = Map.fetch(map, "#{key}")
    # check_blank(raw)
    {key, {:ok, :out}}
  end
end

defmodule WebForm do

end

defmodule MyApp.Fields do
  def username do
    WebForm.Input.Text.new(pattern: ~r/[a-z]+/)
  end

defmodule MyApp.SignUpForm do

  def validate(form) do
    validator = %{
      username: {MyApp.Fields.Email, []},
      other: MyApp.Fields.Email
    }

    for {key, validator} <- validators do
      case validator do
        {field, options} ->
          field.take(key, options, form)
      end
    end
  end
end
