#!/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