Support App.transform
Apply the transform to a Keyboard. Onwards to the final demonstration!
This commit is contained in:
parent
61a2fb108d
commit
244503bba9
5 changed files with 57 additions and 1 deletions
14
scratch/brilliant/App.hs
Normal file
14
scratch/brilliant/App.hs
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue