keycode-0.1: Maps web browser keycodes to their corresponding keyboard keys

Copyright(C) 2015 Ryan Scott
LicenseBSD-style (see the file LICENSE)
MaintainerRyan Scott
StabilityExperimental
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.KeyCode

Description

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

Synopsis

Documentation

data Key Source

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 KeyCodes, but is simply provided for convenience.

Since: 0.1

Constructors

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: 0. With Shift: ).

Digit1

Without Shift: 1. With Shift: !.

Digit2

Without Shift: 2. With Shift: @.

Digit3

Without Shift: 3. With Shift: #.

Digit4

Without Shift: 4. With Shift: $.

Digit5

Without Shift: 5. With Shift: %.

Digit6

Without Shift: 6. With Shift: ^.

Digit7

Without Shift: 7. With Shift: &.

Digit8

Without Shift: 8. With Shift: *.

Digit9

Without Shift: 9. With Shift: (.

KeyA

Without Shift: a. With Shift: A.

KeyB

Without Shift: b. With Shift: B.

KeyC

Without Shift: c. With Shift: C.

KeyD

Without Shift: d. With Shift: D.

KeyE

Without Shift: e. With Shift: E.

KeyF

Without Shift: f. With Shift: F.

KeyG

Without Shift: g. With Shift: G.

KeyH

Without Shift: h. With Shift: H.

KeyI

Without Shift: i. With Shift: I.

KeyJ

Without Shift: j. With Shift: J.

KeyK

Without Shift: k. With Shift: K.

KeyL

Without Shift: l. With Shift: L.

KeyM

Without Shift: m. With Shift: M.

KeyN

Without Shift: n. With Shift: N.

KeyO

Without Shift: o. With Shift: O.

KeyP

Without Shift: p. With Shift: P.

KeyQ

Without Shift: q. With Shift: Q.

KeyR

Without Shift: r. With Shift: R.

KeyS

Without Shift: s. With Shift: S.

KeyT

Without Shift: t. With Shift: T.

KeyU

Without Shift: u. With Shift: U.

KeyV

Without Shift: v. With Shift: V.

KeyW

Without Shift: w. With Shift: W.

KeyX

Without Shift: x. With Shift: X.

KeyY

Without Shift: y. With Shift: Y.

KeyZ

Without Shift: z. With Shift: Z.

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: ;. With Shift: :.

Equals

Without Shift: =. With Shift: +.

Comma

Without Shift: ,. With Shift: <.

Subtract

Without Shift: -. With Shift: _.

Period

Without Shift: .. With Shift: >.

ForwardSlash

Without Shift: /. With Shift: ?.

Backquote

Without Shift: `. With Shift: ~.

BracketLeft

Without Shift: [. With Shift: {.

Backslash

Without Shift: \. With Shift: |.

BracketRight

Without Shift: ]. With Shift: }.

Apostrophe

Without Shift: '. With Shift: ".

UnknownKey 

type KeyCode = Int Source

A numeric code representing the value of a pressed Key. Note that a particular Key may not uniquely map to a particular KeyCode, as the implementation of key codes is browser-dependent.

Since: 0.1

keyCodeLookup :: KeyCode -> Key Source

Determine the Key that a KeyCode represents. If one cannot be found, UnknownKey is returned.

Since: 0.1

keyCodeMap :: IntMap Key Source

An map of known KeyCodes to Keys.

Since: 0.1