This file contains 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
#!/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