Typelevel programming allows developers to encode several flavours of runtime invariants into the type system. Unfortunately, libraries that support typelevel programming tend to be poorly documented, difficult to understand and difficult to hack. This makes them hard to customize to the needs of a specific project/problem.
TypeQuux provides concise, efficient and easy-to-modify implementations of several typelevel programming primitives. As such, it represents collected wisdom on type-hackery in scala.
To use, add the following line to your
libraryDependencies += "com.simianquant" %% "typequux" % "0.7.2" // scala-jvm libraryDependencies += "com.simianquant" %%% "typequux" % "0.7.2" // native/scala-js/cross
Currently, 2.11 and 2.12 binaries are supported.
Currently supported primitives are:
- Church encodings of booleans
- Peano numbers
- Dense numbers (like peano numbers but much faster)
- Natural Transformations
- Type Unions and Exclusions
- Singleton types for literals
- Covariant heterogenous lists
- HList style operations on tuples
- Collections with statically known sizes
- Collections indexed by a string, which are like associative maps with static guarantees
- Records, which are like adhoc classes
- Constraints, that allow you to abstract over arity and structure
Copyright 2017 Harshad Deo
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.