[Haskell-beginners] Map instances in the list-tries package

Matthew Moppett matthewmoppett at gmail.com
Mon Dec 19 13:02:42 CET 2011


I want to use the list-tries package for a little hobby project, but my
naive idea about how it should work is obviously wrong:

module TryPat where
import Data.ListTrie.Patricia.Map

a = singleton "harry" 99

yields the error:

    No instance for (Data.ListTrie.Base.Map.Map map0 Char)
      arising from a use of `singleton'
    Possible fix:
      add an instance declaration for
      (Data.ListTrie.Base.Map.Map map0 Char)
    In the expression: singleton "harry" 99
    In an equation for `a': a = singleton "harry" 99

Now, there is some stuff about this in the docs:

  The data types are parametrized over the map type they use internally to
  store the child nodes: this allows extending them to support different
kinds
  of key types or increasing efficiency. Child maps are required to be
  instances of the Map class in
Data.ListTrie.Base.Map<http://hackage.haskell.org/packages/archive/list-tries/0.4.1/doc/html/Data-ListTrie-Patricia-Map.html>.
Some operations
  additionally require an OrdMap instance.

But frankly, I don't understand it, especially the type signatures. Any
hints on how I might go about making an instance for Map map0 Char?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111219/626d8977/attachment.htm>


More information about the Beginners mailing list