Skip to content
type level sets
Haskell
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmptype Release cmptype 0.2.0.0 and magic-tyfams 0.1.1.0 Aug 11, 2019
magic-tyfams Release type-sets 0.1.1.0 Aug 11, 2019
src/Type Release type-sets 0.1.1.0 Aug 11, 2019
test Release type-sets 0.1.1.0 Aug 11, 2019
.gitignore Experiment with a red-black-tree set (#6) Aug 11, 2019
.travis.yml Split out tyfam generation into its own package Aug 5, 2019
ChangeLog.md Release type-sets 0.1.1.0 Aug 11, 2019
LICENSE
README.md Update README.md Aug 7, 2019
Setup.hs initial commit Aug 4, 2019
cabal.project fix cabal package Aug 5, 2019
package.yaml Release type-sets 0.1.1.0 Aug 11, 2019
stack.yaml Split out tyfam generation into its own package Aug 5, 2019
stack.yaml.lock initial commit Aug 4, 2019
type-sets.cabal Release type-sets 0.1.1.0 Aug 11, 2019

README.md

type-sets

Build Status Hackage

Dedication

Obstacles don't have to stop you. If you run into a wall, don't turn around and give up. Figure out how to climb it, go through it, or work around it.

-- Michael Jordan, on complexity analysis in Haskell

Overview

How much do you hate programming at the type level, but only being able to use lists? A million? Two million? Some mathematicians suspect that there may be even larger degrees of hate.

Enter type-sets. They're sets... at the type-level! Check this:

{-# OPTIONS_GHC -fplugin=Type.Compare.Plugin #-}

import Type.Set

type MySet = Insert Bool (Insert String (Insert (Maybe Int) 'Empty))

test1 :: Proxy (Member Bool MySet) -> Proxy 'True
test1 = id  -- Bool is a member :)

test2 :: Proxy (Member Char MySet) -> Proxy 'False
test2 = id  -- Char is not a member :(

See the Type.Set module for more operations.

But wait, there's more! There's also a proof-of-concept Type.Set.Variant for describing open-sums indexed by type-sets. PRs to make it better would be greatly appreciated!

One love.

Acknowledgments

Huge shout-outs to Boris Rozinov for all of his help on this library, including the original idea, help with the implementation, infinite amounts of coffee, and a couch to sleep on while it was being made.

You can’t perform that action at this time.