Copyright | (C) 2015 Ryan Scott |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Ryan Scott |
Stability | Experimental |
Portability | Portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Keyboard events in web browsers are often represented as keycodes, which (1) are
difficult to remember, and (2) sometimes vary from browser to browser. This module
allows one to look up a key press's KeyCode
and get a plain English description
of the Key
that was pressed, to reduce confusion.
Since: 0.1
- data Key
- = Backspace
- | Tab
- | NumLock
- | Enter
- | Shift
- | Control
- | Alt
- | Pause
- | CapsLock
- | Escape
- | Space
- | PageUp
- | PageDown
- | End
- | Home
- | ArrowLeft
- | ArrowUp
- | ArrowRight
- | ArrowDown
- | PrintScreen
- | Insert
- | Delete
- | Digit0
- | Digit1
- | Digit2
- | Digit3
- | Digit4
- | Digit5
- | Digit6
- | Digit7
- | Digit8
- | Digit9
- | KeyA
- | KeyB
- | KeyC
- | KeyD
- | KeyE
- | KeyF
- | KeyG
- | KeyH
- | KeyI
- | KeyJ
- | KeyK
- | KeyL
- | KeyM
- | KeyN
- | KeyO
- | KeyP
- | KeyQ
- | KeyR
- | KeyS
- | KeyT
- | KeyU
- | KeyV
- | KeyW
- | KeyX
- | KeyY
- | KeyZ
- | Command
- | Numpad0
- | Numpad1
- | Numpad2
- | Numpad3
- | Numpad4
- | Numpad5
- | Numpad6
- | Numpad7
- | Numpad8
- | Numpad9
- | NumpadMultiply
- | NumpadAdd
- | NumpadEnter
- | NumpadSubtract
- | NumpadDecimal
- | NumpadDivide
- | F1
- | F2
- | F3
- | F4
- | F5
- | F6
- | F7
- | F8
- | F9
- | F10
- | F11
- | F12
- | ScrollLock
- | Semicolon
- | Equals
- | Comma
- | Subtract
- | Period
- | ForwardSlash
- | Backquote
- | BracketLeft
- | Backslash
- | BracketRight
- | Apostrophe
- | UnknownKey
- type KeyCode = Int
- keyCodeLookup :: KeyCode -> Key
- keyCodeMap :: IntMap Key
Documentation
Represents a typical keyboard's keys. The lowercase and uppercase variants of any
particular key have the same KeyCode
, so there are not separate constructors for
them. There is also an UnknownKey
constructor for keys without a particular
KeyCode
.
Note that the Enum
instance does not correspond to the KeyCode
s, but is simply
provided for convenience.
Since: 0.1
Backspace | |
Tab | |
NumLock | |
Enter | |
Shift | |
Control | |
Alt | |
Pause | |
CapsLock | |
Escape | |
Space | |
PageUp | |
PageDown | |
End | |
Home | |
ArrowLeft | |
ArrowUp | |
ArrowRight | |
ArrowDown | |
PrintScreen | |
Insert | |
Delete | |
Digit0 | Without Shift: |
Digit1 | Without Shift: |
Digit2 | Without Shift: |
Digit3 | Without Shift: |
Digit4 | Without Shift: |
Digit5 | Without Shift: |
Digit6 | Without Shift: |
Digit7 | Without Shift: |
Digit8 | Without Shift: |
Digit9 | Without Shift: |
KeyA | Without Shift: |
KeyB | Without Shift: |
KeyC | Without Shift: |
KeyD | Without Shift: |
KeyE | Without Shift: |
KeyF | Without Shift: |
KeyG | Without Shift: |
KeyH | Without Shift: |
KeyI | Without Shift: |
KeyJ | Without Shift: |
KeyK | Without Shift: |
KeyL | Without Shift: |
KeyM | Without Shift: |
KeyN | Without Shift: |
KeyO | Without Shift: |
KeyP | Without Shift: |
KeyQ | Without Shift: |
KeyR | Without Shift: |
KeyS | Without Shift: |
KeyT | Without Shift: |
KeyU | Without Shift: |
KeyV | Without Shift: |
KeyW | Without Shift: |
KeyX | Without Shift: |
KeyY | Without Shift: |
KeyZ | Without Shift: |
Command | Might also be the Windows key or the Super key |
Numpad0 | |
Numpad1 | |
Numpad2 | |
Numpad3 | |
Numpad4 | |
Numpad5 | |
Numpad6 | |
Numpad7 | |
Numpad8 | |
Numpad9 | |
NumpadMultiply | |
NumpadAdd | |
NumpadEnter | |
NumpadSubtract | |
NumpadDecimal | |
NumpadDivide | |
F1 | |
F2 | |
F3 | |
F4 | |
F5 | |
F6 | |
F7 | |
F8 | |
F9 | |
F10 | |
F11 | |
F12 | |
ScrollLock | |
Semicolon | Without Shift: |
Equals | Without Shift: |
Comma | Without Shift: |
Subtract | Without Shift: |
Period | Without Shift: |
ForwardSlash | Without Shift: |
Backquote | Without Shift: |
BracketLeft | Without Shift: |
Backslash | Without Shift: |
BracketRight | Without Shift: |
Apostrophe | Without Shift: |
UnknownKey |
keyCodeLookup :: KeyCode -> Key Source
Determine the Key
that a KeyCode
represents. If one cannot be found,
UnknownKey
is returned.
Since: 0.1