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

[ bsd3, data-structures, library, type-system ] [ Propose Tags ]

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) $
            Empty

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

-- 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.

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.5, 0.6, 0.6.1, 0.7, 0.8.0.0, 0.8.5.0, 0.8.6.0, 0.8.7.0, 0.8.9.0
Dependencies base (>=4.7 && <5), ghc-prim [details]
License BSD-3-Clause
Copyright 2013-14 University of Cambridge
Author Dominic Orchard
Maintainer Dominic Orchard
Revised Revision 1 made by AdamBergmark at 2016-02-11T16:28:36Z
Category Type System, Data Structures
Source repo head: git clone https://github.com/dorchard/type-level-sets
Uploaded by DominicOrchard at 2014-09-11T14:48:21Z
Distributions
Reverse Dependencies 5 direct, 0 indirect [details]
Downloads 6766 total (34 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]