     -> Parser<Element, Element>
     where Element: Equatable
 {
-    return acceptIf(predicate: predicate,
-                    errorMessageSupplier: { e in "\(kind) expected" })
+    return acceptIf(errorMessageSupplier: { e in "\(kind) expected" },
+                    predicate)
 }
 
 /// Create a parser that accepts a single input element and returns the parsed element (i.e. `element`).

///   - element: The input element to be tested.
///   - invalidElement: The input element which did not satisfy the predicate.
///
public func acceptIf<Element>(predicate: @escaping (_ element: Element) -> Bool,
                              errorMessageSupplier: @escaping (_ invalidElement: Element) -> String)
    -> Parser<Element, Element>
{
    return Parser { input in
        guard !input.atEnd else {
            return Done(.failure(message: "end of input",
                                 remaining: input))
        }

        let element = input.first

        guard predicate(element) else {
            let message = errorMessageSupplier(element)
            return Done(.failure(message: message,
                                 remaining: input))
        }

        return Done(.success(value: element,
                             remaining: input.rest()))
    }
}

/// Create a parser that accepts a single input element that satisfies a given predicate,

public func accept<Element>(_ element: Element) -> Parser<Element, Element>
    where Element: Equatable
{
    return acceptIf(errorMessageSupplier: { e in "expected \(element) but found \(e)" }) {
        $0 == element
    }
}

/// Create a parser that accepts a single character and returns the parsed character (i.e. `char`).
