The open-typerep package

[Tags: bsd3, library]

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.


Versions0.1, 0.2, 0.3.1, 0.3.2, 0.3.3
Change logNone available
Dependenciesbase (==4.*), constraints (>=0.3), mtl (>=2.2.1), syntactic (>=3), tagged (>=0.4) [details]
CopyrightCopyright (c) 2014, Emil Axelsson
AuthorEmil Axelsson
CategoryDependent Types
Home page
Bug tracker
Source repositoryhead: git clone
UploadedFri Nov 13 12:16:32 UTC 2015 by EmilAxelsson
Downloads426 total (26 in last 30 days)
0 []
StatusDocs available [build log]
Last success reported on 2015-11-13 [all 1 reports]




Maintainers' corner

For package maintainers and hackage trustees