diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-05T20·52+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-05T20·52+0100 |
commit | d948ed9ebfc6deffa622a63d13045b83adc2a507 (patch) | |
tree | 468268da49f544a557d24607378d673d861c5610 | |
parent | 1af0007a7d5db3350a55aef8e3c9ac0ec994b6e1 (diff) |
Define an instance for Show for a Keyboard
This will help me debug.
-rw-r--r-- | scratch/brilliant/Keyboard.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scratch/brilliant/Keyboard.hs b/scratch/brilliant/Keyboard.hs new file mode 100644 index 000000000000..c5baaa5f2474 --- /dev/null +++ b/scratch/brilliant/Keyboard.hs @@ -0,0 +1,23 @@ +-------------------------------------------------------------------------------- +module Keyboard where +-------------------------------------------------------------------------------- +import Utils +import qualified Data.List as List +-------------------------------------------------------------------------------- + +newtype Keyboard = Keyboard [[Char]] + +instance Show Keyboard where + show (Keyboard xxs) = + xxs |> fmap printRow |> List.intercalate "\n" + where + printRow :: [Char] -> String + printRow xs = + xs |> fmap (\x -> '[':x:']':"") |> List.intercalate "" + +qwerty :: Keyboard +qwerty = Keyboard [ ['1','2','3','4','5','6','7','8','9','0'] + , ['Q','W','E','R','T','Y','U','I','O','P'] + , ['A','S','D','F','G','H','J','K','L',';'] + , ['Z','X','C','V','B','N','M',',','.','/'] + ] |