Any better way to write the (fn).() thing?

You could use the ~> syntax, available in Elixir2_000 :stuck_out_tongue: (Match on the end of a pipe (Matchpipe?))

  def is_sql_select?(sql) when not is_nil(sql) do
    sql
    |> String.trim_leading()
    |> String.slice(0, 6)
    |> String.upcase()
    |> x ~> x == "SELECT"
  end