<commit_before>// # module: Text.PrettyPrinting
//
// This module is an implementation of Wadler's [Pretty Printer][pp].
// As described in the paper, the pretty printer is an efficient
// algebra that supports multiple adaptable layouts according to the
// available space.
// [pp]: http:\/\/homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf


// -- Dependencies -----------------------------------------------------
var { Base }  = require('adt-simple');
var { curry } = require('core.lambda');
var { trampoline, done, ternary } = require('./tramp')

// -- Data structures --------------------------------------------------
//
// The pretty printer uses two algebras:
//
// The simple pretty printer is an algebra for documents that
// represents them as a concatenation of items. Each item may be one
// of the following:
union Doc {
  Nil,                  // Nothing, used as identity;
  Text(String, Doc),    // Some text;
  Line(Number, Doc)     // A line break, indented by a given amount;
} deriving (Base)

// To allow (efficient) alternative layouts, a different algebra
// for documents is used, where we see things as a set of possible
// layouts for the same document.
//
// In this version we have more tags, since we add explicit representations
// for concatenation and nesting, and make some internal assumptions
// for the sake efficiency. These assumptions must be preserved whenever
// documents are built, and to enforce that, users are not given these<commit_msg>Fixes link in documentation.<commit_after>// # module: Text.PrettyPrinting
//
// This module is an implementation of Wadler's [Pretty Printer][pp].
// As described in the paper, the pretty printer is an efficient
// algebra that supports multiple adaptable layouts according to the
// available space.
// [pp]: http:\/\/homepages.inf.ed.ac.uk\/wadler\/papers\/prettier\/prettier.pdf


// -- Dependencies -----------------------------------------------------
var { Base }  = require('adt-simple');
var { curry } = require('core.lambda');
var { trampoline, done, ternary } = require('./tramp')

// -- Data structures --------------------------------------------------
//
// The pretty printer uses two algebras:
//
// The simple pretty printer is an algebra for documents that
// represents them as a concatenation of items. Each item may be one
// of the following:
union Doc {
  Nil,                  // Nothing, used as identity;
  Text(String, Doc),    // Some text;
  Line(Number, Doc)     // A line break, indented by a given amount;
} deriving (Base)

// To allow (efficient) alternative layouts, a different algebra
// for documents is used, where we see things as a set of possible
// layouts for the same document.
//
// In this version we have more tags, since we add explicit representations
// for concatenation and nesting, and make some internal assumptions
// for the sake efficiency. These assumptions must be preserved whenever
// documents are built, and to enforce that, users are not given these
{'fraction_non_alphanumeric': 0.16716517115320703, 'fraction_numerical': 0.0, 'mean_word_length': 2.463751438434983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1299678', 'n_tokens_mistral': 765, 'n_tokens_neox': 722, 'n_words': 348}