   """
   @spec compare(version, version) :: :gt | :eq | :lt
   def compare(version1, version2) do
-    do_compare(to_matchable(version1), to_matchable(version2))
-  end
-
-  defp do_compare({major1, minor1, patch1, pre1}, {major2, minor2, patch2, pre2}) do
+    do_compare(to_matchable(version1, true), to_matchable(version2, true))
+  end
+
+  defp do_compare({major1, minor1, patch1, pre1, _}, {major2, minor2, patch2, pre2, _}) do
     cond do
       {major1, minor1, patch1} > {major2, minor2, patch2} -> :gt
       {major1, minor1, patch1} < {major2, minor2, patch2} -> :lt

      end
    end

    defp main_condition(op, major, minor, patch) do
      {op, {{:'$1', :'$2', :'$3'}},
           {:const, {major, minor, patch}}}
    end

    defp pre_condition(:'>', pre) do

    end
  end

  defp to_matchable(%Version{major: major, minor: minor, patch: patch, pre: pre}, allow_pre?) do
    {major, minor, patch, pre, allow_pre?}
  end

  defp to_matchable(string, allow_pre?) do
    case Version.Parser.parse_version(string) do
      {:ok, {major, minor, patch, pre}} ->
        {major, minor, patch, pre, allow_pre?}
      :error ->
        raise InvalidVersionError, message: string
    end
  end

