
(moving from haskell@ to haskell-cafe@) Hi David, As someone who is not familiar with the concept of polygonal maps, I find this package severely underdocumented. What is a polymap? Why would I want to use one? What is storage and how should I choose it? The example clears it up a bit, but it could also use more prose. And perhaps there could be a more motivated example (showing how polymap solves an actual problem). On 09/24/2015 09:53 PM, David Farrell wrote:
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: https://github.com/shockkolate/hs-polymap
Issue Tracker: https://github.com/shockkolate/hs-polymap
Hackage: https://hackage.haskell.org/package/polymap
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 0.1.0.0 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 Haskell@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell