Skip to content

Instantly share code, notes, and snippets.

@plaster
Created February 12, 2013 12:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save plaster/892de307cf6753cec881 to your computer and use it in GitHub Desktop.
Save plaster/892de307cf6753cec881 to your computer and use it in GitHub Desktop.
#!/usr/bin/runghc
type Layout = String
layoutQWERTY :: Layout
layoutQWERTY = "-=" ++
"qwertyuiop[]" ++
"asdfghjkl;'" ++
"zxcvbnm,./" ++
"_+" ++
"QWERTYUIOP{}" ++
"ASDFGHJKL:\"" ++
"ZXCVBNM<>?"
layoutDvorak :: Layout
layoutDvorak = "[]" ++
"',.pyfgcrl/=" ++
"aoeuidhtns-" ++
";qjkxbmwvz" ++
"{}" ++
"\"<>PYFGCRL?+" ++
"AOEUIDHTNS_" ++
":QJKXBMWVZ"
mapCommands :: [String]
mapCommands = ["no", "no!"]
genEntry :: (Char, Char) -> [String]
genEntry (qChar, dChar) = map (\ cmd -> cmd ++ " " ++ [qChar] ++ " " ++ [dChar] ) mapCommands;
genEntries :: Layout -> Layout -> [String]
genEntries srcLayout dstLayout = concatMap genEntry $ zip srcLayout dstLayout
main = do
putStr $ unlines $ genEntries layoutQWERTY layoutDvorak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment