Skip to content

Instantly share code, notes, and snippets.

@bradclawsie
Created December 26, 2011 08:49
Show Gist options
  • Save bradclawsie/1520773 to your computer and use it in GitHub Desktop.
Save bradclawsie/1520773 to your computer and use it in GitHub Desktop.
loaddictionary.hs
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