diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-05T23·18+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-05T23·18+0100 |
commit | 5f52077492160195681a0a9bca806fd78ddbd6fd (patch) | |
tree | 2ab12112b52bda8ecc314954fbdb200443e97454 /scratch/brilliant/App.hs | |
parent | e14fff7d4b04c37155acf046b7b3f350cf6ad3b6 (diff) |
Re-type type using the altered keyboard
Remember: always read the instructions; that's the most important part.
Diffstat (limited to 'scratch/brilliant/App.hs')
-rw-r--r-- | scratch/brilliant/App.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scratch/brilliant/App.hs b/scratch/brilliant/App.hs index dd3f2788a254..bf39de4997ad 100644 --- a/scratch/brilliant/App.hs +++ b/scratch/brilliant/App.hs @@ -5,10 +5,20 @@ import Keyboard (Keyboard(..)) import Transforms (Transform(..)) import Utils ((|>)) +import qualified Data.Char as Char import qualified Utils +import qualified Keyboard +import qualified Data.HashMap.Strict as HM -------------------------------------------------------------------------------- transform :: Keyboard -> Transform -> Keyboard transform (Keyboard xs) HorizontalFlip = xs |> fmap reverse |> Keyboard transform (Keyboard xs) VerticalFlip = xs |> reverse |> Keyboard transform (Keyboard xs) (Shift n) = xs |> fmap (Utils.rotate n) |> Keyboard + +retypePassage :: String -> Keyboard -> Maybe String +retypePassage passage newKeyboard = + passage + |> fmap Char.toUpper + |> traverse (\c -> HM.lookup c Keyboard.charToCoord) + >>= traverse (Keyboard.coordToChar newKeyboard) |