Duh...
Thanks, Arlen.
Michael
--- On Sat, 5/21/11, Arlen Cuss wrote:
From: Arlen Cuss
Subject: Re: [Haskell-cafe] Can't access map value with key.
To: "michael rice"
Cc: haskell-cafe@haskell.org
Date: Saturday, May 21, 2011, 8:17 AM
On Sat, 2011-05-21 at 04:56 -0700, mic
On Sat, 2011-05-21 at 04:56 -0700, michael rice wrote:
> (fromList
> [(("\n","\n"),["I"]),(("\n","I"),["am"]),(("I","am"),["lost."])],("am","lost."),[])
Or splitting that out:
(fromList
[(("\n","\n"),["I"]),(("\n","I"),["am"]),(("I","am"),["lost."])],
("am","lost."),
[])
Note that it's a triple,
:m + Data.MapPrelude Data.Map> let mp = fromList
[(1,'a'),(2,'b'),(3,'c')]Loading package array-0.3.0.1 ... linking ...
done.Loading package containers-0.3.0.0 ... linking ... done.Prelude Data.Map>
:t mpmp :: Map Integer CharPrelude Data.Map> mpfromList
[(1,'
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
What am I doing wrong in the last line of main? If I comment out the last line
of main, my program prints the map (mp) that is created. If I leave it in, the
program fails. The last line should print the list ["I"].
Michael
import Control.Monad.Sta