type-level: Type-level programming library

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

This library permits performing computations on the type-level. Type-level functions are implemented using functional dependencies of multi parameter type classes. To date, Booleans and Numerals (Naturals and Positives) are supported. With regard to Numerals, there is support for common arithmetic operations (addition, substraction, multiplication, division, exponientation, logarithm, maximum, comparison, GCD) over natural numbers (using a decimal representation to make compile-time errors friendlier). Although making use of type-level computations might seem devious and obfuscated at first sight, it is indeed useful in practice to implement lightweight dependent types such us number-parameterized types (e.g. an array type parameterized by the array's size or a modular group type Zn parameterized by the modulus). Here is a tutorial on type-level numerals and how to use them to implement numerically-parameterized vectors: https://forsyde.ict.kth.se/trac/wiki/ForSyDe/Haskell/ForSyDeTutorial#FSVec


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.3.0
Dependencies base (>=4 && <6), syb, template-haskell (>2.0) [details]
Tested with ghc ==7.10.1
License BSD-3-Clause
Copyright Copyright (c) 2008 Alfonso Acosta, Oleg Kiselyov, Wolfgang Jeltsch and KTH's SAM group
Author Alfonso Acosta
Maintainer alfonso.acosta@gmail.com
Category Data
Home page http://code.haskell.org/type-level
Source repo head: git clone https://github.com/forsyde/type-level.git
Uploaded by ugeorge at 2016-07-08T10:29:18Z
Distributions NixOS:0.3.0
Reverse Dependencies 18 direct, 78 indirect [details]
Downloads 7577 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for type-level-0.3.0

[back to package description]
type-level: Type-level programming library

DESCRIPTION


 This library permits performing computations on the type-level. Type-level 
 functions are implemented using functional dependencies of multi
 parameter type classes. 

 To date, Booleans and Numerals (Naturals and Positives) are
 supported. With regard to Numerals, there is support for common
 arithmetic operations (addition, substraction, multiplication,
 division, exponientation, logarithm, maximum, comparison, GCD) 
 over natural numbers (using a decimal representation to make 
 compile-time errors friendlier).

 Although making use of type-level computations might seem devious and
 obfuscated at first sight, it is indeed useful in practice to implement 
 lightweight dependent types such us number-parameterized types (e.g. an array 
 type parameterized by the array's size or a modular group type Zn 
 parameterized by the modulus).

 Here is a tutorial on type-level numerals and how to use them to
implement numerically-parameterized vectors: https://forsyde.ict.kth.se/trac/wiki/ForSyDe/Haskell/ForSyDeTutorial#FSVec

DEPENDENCIES
 
 type-level depends on GHC (due to the use of Multiparameter Type Classes and 
 infix type constructors) and Template Haskell

INSTALLATION

to install globally, for the whole system (requires admin permissions):

$ ./Setup.hs configure
$ ./Setup.hs build
$ ./Setup.hs haddock # generate documentation, optional, 
                     # requires Haddock > 2.0 due to the use of TH
$ ./Setup.hs install

to install locally and just for your own user:

$ ./Setup.hs configure --prefix=The/selected/local/directory
$ ./Setup.hs build
$ ./Setup.hs haddock  # generate documentation, optional, 
                      # requires Haddock > 2.0 due to the use of TH

$ ./Setup.hs install --user