
Charles-Pierre Astolfi
"The old man looked from his glass across the square, then over at the waiters."
You're embarrassingly right! But then, "those the" definitely never appears, altough it does in my generated text.
Otherwise my cursory look turned up no bugs. Unfortunately there is :(
Ahh yes, looking a bit more closely now I have a few points: 1. In `draw`: The first argument is an action which will return a new word. Instead of passing `rword :: RVar Word`, you presumably rather want to pass `word :: Word`. This is likely the cause of your bug. 2. In `draw`: Instead of `weightedSample` which produces a random shuffling of the entire list, you really just want to draw a single word. This is a categorical distribution; use `Data.Random.Categorical.fromList` to construct the distribution and `R.rvar` to draw a variate. Note that you may only want to avoid doing the former more than once as construction of the distribution requires sorting and normalizing. 3. `map (\(x,y)->(y,x))` is just `map swap` where `swap` is provided by `Data.Tuple`. My quick rework of your code can be found here [1]. Cheers, - Ben [1] http://lpaste.net/108025