diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-05T22·20+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-05T22·21+0100 |
commit | 244503bba91c9a99c9ab5a6a74b74d5c9bd9667e (patch) | |
tree | e26248c17d4374ab69647e461613b5bb15a1513c /scratch/brilliant/App.hs | |
parent | 61a2fb108dcdcc599ad9fe9de7b02d1181aec2d1 (diff) |
Support App.transform
Apply the transform to a Keyboard. Onwards to the final demonstration!
Diffstat (limited to 'scratch/brilliant/App.hs')
-rw-r--r-- | scratch/brilliant/App.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scratch/brilliant/App.hs b/scratch/brilliant/App.hs new file mode 100644 index 000000000000..3801eac7a803 --- /dev/null +++ b/scratch/brilliant/App.hs @@ -0,0 +1,14 @@ +-------------------------------------------------------------------------------- +module App where +-------------------------------------------------------------------------------- +import Keyboard (Keyboard(..)) +import Transforms (Transform(..)) +import Utils ((|>)) + +import qualified Utils +-------------------------------------------------------------------------------- + +transform :: Transform -> Keyboard -> Keyboard +transform HorizontalFlip (Keyboard xs) = xs |> fmap reverse |> Keyboard +transform VerticalFlip (Keyboard xs) = xs |> reverse |> Keyboard +transform (Shift n) (Keyboard xs) = xs |> fmap (Utils.rotate n) |> Keyboard |