The open-typerep package

[Tags:benchmark, bsd3, library, test]

This package uses Data Types à la Carte to provide open type representations and dynamic types/coercions for open type universes.

Example 1 (dynamic types):

 type MyUniverse = IntType :+: BoolType

 hlist :: [Dynamic MyUniverse]
 hlist = [toDyn True, toDyn (1 :: Int)]
 *Main> hlist

Note that if we were using Data.Dynamic, it would just print


Example 2 (dynamically typed addition):

 addDyn :: (TypeEq ts ts, PWitness Num ts ts) => Dynamic ts -> Dynamic ts -> Maybe (Dynamic ts)
 addDyn (Dyn ta a) (Dyn tb b) = do
     Dict <- typeEq ta tb
     Dict <- pwit pNum ta
     return (Dyn ta (a+b))

Data.Dynamic could only do this monomorphically, for one Num type at a time.


Versions 0.1, 0.2, 0.3.1, 0.3.2, 0.3.3, 0.4, 0.5, 0.6, 0.6.1
Dependencies base (==4.*), base-orphans, constraints (>=0.3), mtl (>=2.2.1), syntactic (>=3.1), tagged (>=0.4), template-haskell [details]
License BSD3
Copyright Copyright (c) 2014-2016, Emil Axelsson
Author Emil Axelsson
Category Dependent Types
Home page
Bug tracker
Source repository head: git clone
Uploaded Fri May 27 14:19:12 UTC 2016 by EmilAxelsson
Distributions NixOS:0.6.1
Downloads 881 total (17 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2016-05-27 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees