[Haskell-cafe] Can't access map value with key.
Arlen Cuss
celtic at sairyx.org
Sat May 21 05:36:53 CEST 2011
On Fri, 2011-05-20 at 19:04 -0700, michael rice wrote:
> markov4.hs:35:27: Couldn't match expected type `Map k a'
> against inferred type `(Map Prefix [String], Prefix, [String])'
ghc seems to believe `mp' here is not just a map, but the entire state
(which is what execState is meant to give you).
> type GeneratorState = State ((Map Prefix [String]),Prefix,[String])
The state is a triple, so you need to match to get the real map out:
> let (themap,_,_) = mp
> putStrLn $ show $ themap ! (non_word,non_word)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110521/65f2c053/attachment.pgp>
More information about the Haskell-Cafe
mailing list