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

Stephen Tetley stephen.tetley at gmail.com
Mon Dec 19 15:07:28 CET 2011


Hi Matthew

You'll have to give `a` a concrete type, as `singleton` is overloaded,
GHC cannot infer a type.

The TrieMap type is quite complicated as it allows different
representations of (finite) Maps within it. There are three different
internal maps you can use (the three pre-defined instances of the Map
class - Data.Map, WrappedIntMap and AList) - I'd go for Data.Map as it
will be faster than AList and I think you are using Char for key so
you can't use an IntMap.

I don't have the package `list-tries` installed but I'd guess at one
of these two for the concrete type signature.

Assuming you have imported Data.Map as

import qualified Data.Map as Map

(Probably this...)
a :: TrieMap Map.Map [Char] Int


(Possibly this...)
a :: TrieMap (Map.Map Char Int) [Char] Int



More information about the Beginners mailing list