Created
December 26, 2011 08:49
-
-
Save bradclawsie/1520773 to your computer and use it in GitHub Desktop.
loaddictionary.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import qualified Data.List as L | |
import qualified Control.Monad as C | |
import qualified Network.Memcache as MC | |
import qualified Network.Memcache.Protocol as S | |
setword conn word = do | |
success <- MC.set conn word (1 :: Int) | |
C.when (success == False) $ print word | |
return success | |
main = do | |
conn <- S.connect "127.0.0.1" 11212 | |
words <- (C.liftM lines . readFile) "/etc/dictionaries-common/words" | |
sets <- C.mapM (setword conn) words | |
S.disconnect conn | |
print $ L.all (== True) sets | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment