         }
         return (String(characters), remainder)
     }
-    return parser
 }
 
 // Parsers
 
-private let null: Parser<Value> = map(word("null")) { _ in Value.null }
+private let null: Parser<Value> = {
+    return map(word("null")) { _ in Value.null }
+}()
 
 private let bool: Parser<Value> = {
     let `true` = map(word("true")) { _ in true }

        }
        return nil
    }
    return parser
}

private func many<A>(_ parser: @escaping Parser<A>) -> Parser<[A]> {
    let parser: Parser<[A]> = { stream in
        var result = [A]()
        var remainder = stream
        while let (element, newRemainder) = parser(remainder) {

private typealias Parser<A> = (Stream) -> (A, Stream)?

private func map<A, B>(_ parser: @escaping Parser<A>, _ transform: @escaping (A) -> B) -> Parser<B> {
    return { stream in
        guard let (result, remainder) = parser(stream) else { return nil }
        return (transform(result), remainder)
    }
}

private func or<A>(_ leftParser: @escaping Parser<A>, _ rightParser: @escaping Parser<A>) -> Parser<A> {
    return { stream in
        return leftParser(stream) ?? rightParser(stream)
    }
}

private func one<A>(of parsers: [Parser<A>]) -> Parser<A> {
    return { stream in
        for parser in parsers {
            if let x = parser(stream) {
                return x
