swarm-0.5.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Language.Key

Description

Parsing and pretty-printing for keys (as in, keys on a keyboard) and key combos.

Synopsis

Documentation

data KeyCombo Source #

A keyboard input, represented as a key + modifiers. Invariant: the modifier list is always sorted.

Instances

Instances details
FromJSON KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

ToJSON KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

Generic KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

Associated Types

type Rep KeyCombo :: Type -> Type #

Methods

from :: KeyCombo -> Rep KeyCombo x #

to :: Rep KeyCombo x -> KeyCombo #

Show KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

Eq KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

Ord KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

type Rep KeyCombo Source # 
Instance details

Defined in Swarm.Language.Key

type Rep KeyCombo = D1 ('MetaData "KeyCombo" "Swarm.Language.Key" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'False) (C1 ('MetaCons "KeyCombo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Key) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Modifier])))

mkKeyCombo :: [Modifier] -> Key -> KeyCombo Source #

Smart constructor for KeyCombo.

parseKeyComboFull :: Parser KeyCombo Source #

Parse a key combo with nothing after it.

parseKeyCombo :: Parser KeyCombo Source #

Parse a key combo like "M-C-F5", "Down", or "C-x".

prettyKeyCombo :: KeyCombo -> Text Source #

Pretty-print a key combo, e.g. "C-M-F5". Right inverse to parseKeyCombo. Left inverse up to reordering of modifiers.

Orphan instances