<commit_before>#pragma once

#include <cps/base_future.h>

namespace cps {

/**
 * A subclass of cps::base_future which represents a chained future.
 */
class sequence_future : public base_future {
public:
	sequence_future(
		const std::string &label = u8"unlabelled future"
	):base_future(label)
	{
	}

	virtual ~sequence_future() { }

	virtual const base_future::future_type type() const { return base_future::sequence; }

	static
	std::shared_ptr<sequence_future>
	create() {
		// Defeat private constructor if necessary
		struct accessor : public sequence_future { };
		return std::make_shared<accessor>();
	}

	template<typename U>
	std::shared_ptr<leaf_future<U>>
	as()
	{
		if(!is_done())
			throw base_future::ready_exception();

		if(inner_->type() != base_future::leaf)
			throw type_exception();

		return std::dynamic_pointer_cast<leaf_future<U>>(inner_);
	}

	std::shared_ptr<sequence_future>
	inner(std::shared_ptr<base_future> f)<commit_msg>Pass label in ->create<commit_after>#pragma once

#include <cps/base_future.h>

namespace cps {

/**
 * A subclass of cps::base_future which represents a chained future.
 */
class sequence_future : public base_future {
public:
	sequence_future(
		const std::string &label = u8"unlabelled future"
	):base_future(label)
	{
	}

	virtual ~sequence_future() { }

	virtual const base_future::future_type type() const { return base_future::sequence; }

	static
	std::shared_ptr<sequence_future>
	create(
		const std::string &label = u8"unlabelled future"
	) {
		// Defeat private constructor if necessary
		// struct accessor : public sequence_future { };
		return std::make_shared<sequence_future>(label);
	}

	template<typename U>
	std::shared_ptr<leaf_future<U>>
	as()
	{
		if(!is_done())
			throw base_future::ready_exception();

		if(inner_->type() != base_future::leaf)
			throw type_exception();

		return std::dynamic_pointer_cast<leaf_future<U>>(inner_);
	}

	std::shared_ptr<sequence_future>
	inner(std::shared_ptr<base_future> f)
{'fraction_non_alphanumeric': 0.1297134238310709, 'fraction_numerical': 0.0015082956259426848, 'mean_word_length': 5.503267973856209, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2948833', 'n_tokens_mistral': 700, 'n_tokens_neox': 654, 'n_words': 139}