<commit_before>//
//  Box.swift
//  Swiftx
//
//  Created by <NAME> on 6/9/14.
//  Copyright (c) 2014 TypeLift. All rights reserved.
//

/// An immutable reference type holding a singular value.
///
/// Boxes are often used when the Swift compiler cannot infer the size of a struct or enum because
/// one of its generic types is being used as a member.
public final class Box<T> {
	private let val : @autoclosure(escaping) () -> T
	
	public var value: T { return val() }
	
	public init(_ value : T) {
		self.value = value
	}
	
	// Type inference fails here.  rdar://19347652
	public func map<U>(f : T -> U) -> Box<U> {
		return Box<U>(f(value))
	}
}

/// Fmap | Applies a function to the value of the receiver to yield a new box.
public func <^> <T, U>(f : T -> U, x : Box<T>) -> Box<U> {
	return x.map(f)
}

extension Box : Printable {
	public var description: String {
		return "Box(\(toString(value)))"
	}
}<commit_msg>Fix initializer<commit_after>//
//  Box.swift
//  Swiftx
//
//  Created by <NAME> on 6/9/14.
//  Copyright (c) 2014 TypeLift. All rights reserved.
//

/// An immutable reference type holding a singular value.
///
/// Boxes are often used when the Swift compiler cannot infer the size of a struct or enum because
/// one of its generic types is being used as a member.
public final class Box<T> {
	private let val : @autoclosure(escaping) () -> T
	
	public var value : T { return val() }
	
	public init(_ value : T) {
		self.val = value
	}
	
	// Type inference fails here.  rdar://19347652
	public func map<U>(f : T -> U) -> Box<U> {
		return Box<U>(f(self.value))
	}
}

/// Fmap | Applies a function to the value of the receiver to yield a new box.
public func <^> <T, U>(f : T -> U, x : Box<T>) -> Box<U> {
	return x.map(f)
}

extension Box : Printable {
	public var description: String {
		return "Box(\(toString(value)))"
	}
}
{'fraction_non_alphanumeric': 0.14524838012958963, 'fraction_numerical': 0.017278617710583154, 'mean_word_length': 2.7971311475409837, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 31, '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': '5648552', 'n_tokens_mistral': 675, 'n_tokens_neox': 621, 'n_words': 245}