summaryrefslogtreecommitdiff
path: root/src/System/IO/Terminal/Input/Key.hs
blob: 40b52c397afb70f2fd2c2306ae0118df6bfd77b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{-|
Module      : System.IO.Terminal.Input.Key
Copyright   : (c) UU, 2019
License     : MIT
Maintainer  : Tom Smeding
Stability   : experimental
Portability : POSIX, macOS, Windows
-}
module System.IO.Terminal.Input.Key where


-- | A keypress. This does not attempt to model all possible keypresses
-- that the user may enter, since not all can be recognised in the terminal
-- anyway. The argument to 'KInvalid' contains some description of the
-- unknown key.
data Key = KChar Char
         | KUp | KDown | KRight | KLeft
         | KEnter | KDelete | KBackspace
         | KPageDown | KPageUp | KHome | KEnd
         | KTab
         | KEsc
         | KMod { kShift :: Bool
                , kCtrl :: Bool
                , kAlt :: Bool
                , kKey :: Key }
         | KInvalid String
  deriving (Eq, Ord, Show)