ANNOUNCE: polymap

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ANNOUNCE: polymap

David Farrell
I'm excited to announce the first release of a package I've been working
on over the last week called polymap, a library providing type-safe
polygonal maps whose sides are defined by a kindlist of types zipped
with a storage type for each side. I've tried to match the interface
exposed by the containers package as closely as possible. For example:

import Data.Set (Set)
import Data.PolyMap.Nat (first, second, third)
import qualified Data.PolyMap as PM

mEmpty :: PM.PolyMap '[ '(String, Set), '(Int, Set) ]
mEmpty = PM.empty

mOne :: PM.SimplePolyMap '[String, Int] Set
mOne = PM.singleton ("one", length "one")

main = do
     print mEmpty                              -- empty PolyMap
     print mOne                                -- PolyMap with one Relation
     print mTwo                                -- PolyMapwith two Relations
     print (PM.member first "one" mTwo)        -- True
     print (PM.notMember first "asdf" mTwo)    -- True
     --print (PM.notMember second "asdf" mTwo) -- will not typecheck
     --print (PM.notMember third "asdf" mTwo)  -- will not typecheck
     print (PM.lookup first "two" mTwo)        -- second Relation of PolyMap
   where mTwo = PM.insert ("two", length "two") mOne

This is a short usage example of most of the functions currently written
for polymap. There's still a long way to go both in terms of exposed
functions and in terms of efficiency and such, but I felt it prudent to
make a public release of my work so far as I feel it's reached a stage
where it could be beneficial to others. Note that GHC 7.10 (base >=4.8,
GHC extensions) is required.

Git Repository:

Issue Tracker:


The code is licensed under the Unlicense license--that is to say, the
code is released into the public domain for the benefit of others.

I'd love to hear any feedback/suggestions/improvements/anything you want
to say about polymap over the mailing list (which may be more suited to
the haskell-cafe mailing list; I don't know) or in #haskell on Freenode
(I'm usually in there as Shockk).

N.B. Version of the package will not build due to the use of a
function in containers that has been submitted as a pull request but
does not exist yet/at all.
Haskell mailing list
[hidden email]