type-sets: Type-level sets

[ bsd3, library, type ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/isovector/type-sets#readme


[Skip to Readme]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), cmptype (>=0.1.0.0 && <=0.3.0.0) [details]
License BSD-3-Clause
Copyright 2019 Sandy Maguire
Author Sandy Maguire
Maintainer sandy@sandymaguire.me
Category Type
Home page https://github.com/isovector/type-sets#readme
Bug tracker https://github.com/isovector/type-sets/issues
Source repo head: git clone https://github.com/isovector/type-sets
Uploaded by isovector at 2019-08-11T16:05:34Z
Distributions NixOS:0.1.1.0
Downloads 721 total (1 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-08-11 [all 1 reports]

Readme for type-sets-0.1.1.0

[back to package description]

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.