 private typealias Parser<A> = (Stream) -> (A, Stream)?
 
 private func map<A, B>(_ parser: @escaping Parser<A>, _ transform: @escaping (A) -> B) -> Parser<B> {
-    let newParser: Parser<B> = { stream in
+    return { stream in
         guard let (result, remainder) = parser(stream) else { return nil }
         return (transform(result), remainder)
     }
-    return newParser
 }
 
 private func or<A>(_ leftParser: @escaping Parser<A>, _ rightParser: @escaping Parser<A>) -> Parser<A> {
-    let parser: Parser<A> = { stream in
+    return { stream in
         return leftParser(stream) ?? rightParser(stream)
     }
-    return parser
 }
 
 private func one<A>(of parsers: [Parser<A>]) -> Parser<A> {
-    let parser: Parser<A> = { stream in
+    return { stream in
         for parser in parsers {
             if let x = parser(stream) {
                 return x

        }
        return (String(characters), remainder)
    }
    return parser
}

// Parsers

private let null: Parser<Value> = map(word("null")) { _ in Value.null }

private let bool: Parser<Value> = {
    let `true` = map(word("true")) { _ in true }

            return ([element], remainder1)
        }
    }
}

private func between<A, B, C>(_ a: @escaping Parser<A>, _ b: @escaping Parser<B>, _ c: @escaping Parser<C>) -> Parser<B> {
    return { stream in
        guard let (_, remainder1) = a(stream) else { return nil }
        guard let (result2, remainder2) = b(remainder1) else { return nil }
        guard let (_, remainder3) = c(remainder2) else { return nil }
        return (result2, remainder3)
    }
}

private func and<A, B>(_ left: @escaping Parser<A>, _ right: @escaping Parser<B>) -> Parser<(A, B)> {
