From 4d1ea8520afe16bf4e085da381bdbcd0825b5458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Buckwalter?= Date: Wed, 21 Sep 2011 21:53:57 +0800 Subject: [PATCH] Revert 33ee15d56facfc5204b5c4dbade95b44e428bc8b. Revert to the older faster toChar. I would have just removed the old commit from history but it seems that would call for a rebase which I hear is a bad idea in a public branch. Thus this commit. --- yesod-core/Yesod/Internal/Request.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yesod-core/Yesod/Internal/Request.hs b/yesod-core/Yesod/Internal/Request.hs index 8825d27e..ce7ce7d9 100644 --- a/yesod-core/Yesod/Internal/Request.hs +++ b/yesod-core/Yesod/Internal/Request.hs @@ -75,7 +75,10 @@ parseWaiRequest' env session' key' gen = Request gets'' cookies' env langs' nonc randomString :: RandomGen g => Int -> g -> String randomString len = take len . map toChar . randomRs (0, 61) where - toChar i = (['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9']) !! i + toChar i + | i < 26 = toEnum $ i + fromEnum 'A' + | i < 52 = toEnum $ i + fromEnum 'a' - 26 + | otherwise = toEnum $ i + fromEnum '0' - 52 -- | A tuple containing both the POST parameters and submitted files. type RequestBodyContents =