harshad-deo / typequux

A hackable library for typelevel programming in scala

GitHub

TypeQuux

Build Status Build status Maven Central Scala.js Coverage Status Codacy Badge Gitter

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 see what is possible, head on over to the project site or peruse through the API. You can see an indexed view of supported primitives and their operations here.

To use, add the following line to your build.sbt file:

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:

  1. Church encodings of booleans
  2. Peano numbers
  3. Dense numbers (like peano numbers but much faster)
  4. Type-Sets
  5. Type-Maps
  6. Natural Transformations
  7. Type Unions and Exclusions
  8. Singleton types for literals
  9. Covariant heterogenous lists
  10. HList style operations on tuples
  11. Collections with statically known sizes
  12. Collections indexed by a string, which are like associative maps with static guarantees
  13. Records, which are like adhoc classes
  14. Constraints, that allow you to abstract over arity and structure

License

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

http://www.apache.org/licenses/LICENSE-2.0

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.