generateSequence :: (R.MonadRandom m) => MarkovChain -> String -> m String
generateSequence m s
  | not (null s) && last s == '.' = return s
  | otherwise = do
                s' <- R.fromList $ m M.! s
                ss <- generateSequence m s'
                return $ if null s then ss else s ++ " " ++ ss
generateSequence :: (R.MonadRandom m) => MarkovChain -> String -> m String
generateSequence m s
  | not (null s) && last s == '.' = return s
  | otherwise = do
                s' <- R.fromList $ m M.! s
                ss <- generateSequence m s'
                return $ if null s then ss else s ++ " " ++ ss
generateSequence m s
  | not (null s) && last s == '.' = return s
  | otherwise = do
                s' <- R.fromList $ m M.! s
                ss <- generateSequence m s'
                return $ if null s then ss else s ++ " " ++ ss