{'fraction_non_alphanumeric': 0.024691358024691357, 'fraction_numerical': 0.0, 'mean_word_length': 5.45575221238938, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, '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}}
Time Framework: A Type Level and Algebra Driven Design Approach

Time is present in every real world data model. Literature on the subject includes several time models, algebras, formal logics, and ontologies. Furthermore, Functional Programming, Type-level Programming and Algebra Driven Design are valuable assets for constructing systems that are consistent, composable, extensible, highly polymorphic, and predictable. Nevertheless, there is a lack for a purely functional typed time framework that offers ways to construct type safe algebraic time structures and prove their algebraic laws. Our study answers this need by introducing a purely functional typed, highly extensible and polymorphic framework to encode time algebras. The framework can be used to build type safe, composable systems for processing time points and periods with laws as consistency proofs and compile-time optimisation rules. The language used to implement our library is Haskell, which is a purely functional, statically and strongly typed language. Additionally, the library includes dependent types, compile-time reflection, type families, and refined types. As for proofs, they are written as randomised property tests with QuickSpec, or enumerative property tests with SmallCheck. To demonstrate the utility of the framework, we provide two use cases that describe how to construct a time point and period algebraic structure, and how to assert that laws about them hold.