type-level-sets: Type-level sets (with value-level counterparts and various operations)

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.


This package provides type-level sets (no duplicates, sorted to provide a nomral form) via Set, with value-level counterparts. Described in the paper "Embedding effect systems in Haskell" by Dominic Orchard and Tomas Petricek http://www.cl.cam.ac.uk/~dao29/publ/haskell14-effects.pdf (Haskell Symposium, 2014)

Here is a brief example:

import Data.Type.Set

foo :: Set '["x" :-> Int, "z" :-> Int, "w" :-> Int]
foo = Ext ((Var :: (Var "x")) :-> 2) $
        Ext ((Var :: (Var "z")) :-> 4) $
          Ext ((Var :: (Var "w")) :-> 5) $

bar :: Set '["y" :-> Int, "w" :-> Int]
bar = Ext ((Var :: (Var "y")) :-> 3) $
        Ext ((Var :: (Var "w")) :-> 1) $

-- foobar :: Set '["w" :-> Int, "x" :-> Int, "y" :-> Int, "z" :-> Int]
foobar = foo `union` bar

The Set type for foobar here shows the normalised form (sorted with no duplicates). The type signatures is commented out as it can be infered. Running the example we get:

>>> foobar
[(Var :-> 1), (Var :-> 2), (Var :-> 3), (Var :-> 4)]

Thus, we see that the first value paired with the "w" variable is dropped.


Versions0.5, 0.5, 0.6, 0.6.1, 0.7,,,,
Change logNone available
Dependenciesbase (<5), ghc-prim [details]
Copyright2013-14 University of Cambridge
AuthorDominic Orchard
MaintainerDominic Orchard
CategoryType System, Data Structures
Source repositoryhead: git clone https://github.com/dorchard/type-level-sets
UploadedThu Sep 11 14:46:21 UTC 2014 by DominicOrchard




Maintainers' corner

For package maintainers and hackage trustees