Better design pattern for creating a polymorphic API

I don’t control the calling code. ExAws does that part. It just calls the parser I provide as an argument.

Here’s how I currently send the parser:

  def list_users(opts \\ []) do
    :list_users
    |> to_params(opts)
    |> to_op(parser: &Parser.parse/2)
  end

So it’s easy enough to replace |> to_op(parser: &Parser.parse/2) with |> to_op(parser: &Parsers.User.parse/2). But I was looking for a better way.