Safe Haskell | None |
---|---|
Language | Haskell2010 |
- int2keychord :: Integer -> [KeyChord]
- digit2keychord :: (MonadThrow m, Num a, Eq a, Show a) => a -> m KeyChord
- char2keychord :: MonadThrow m => Char -> m KeyChord
- keychord2char :: MonadThrow m => KeyChord -> m Char
Documentation
int2keychord :: Integer -> [KeyChord] Source #
>>>
int2keychord -12
[([],MinusKey),([],OneKey),([],TwoKey)]
digit2keychord :: (MonadThrow m, Num a, Eq a, Show a) => a -> m KeyChord Source #
a (base ten) digit is a number between zero and nine inclusive.
>>>
digit2keychord 2
([],TwoKey)
>>>
digit2keychord -2
Nothing
>>>
digit2keychord 12
Nothing
char2keychord :: MonadThrow m => Char -> m KeyChord Source #
the keychord that would insert the character into the application.
>>>
char2keychord '@' :: Maybe KeyChord
Just ([ShiftModifier], TwoKey)
some characters cannot be represented as keychordes, like some non-printable characters (in arbitrary applications, not just the terminal emulator):
>>>
char2keychord '\0' :: Maybe KeyChord
Nothing
case char2keychord c of { Just ([],_) -> True; Just ([ShiftModifier],_) -> True; Nothing -> True; _ -> False }
keychord2char :: MonadThrow m => KeyChord -> m Char Source #
the character that represents the keychord:
>>>
keychord2char ([ShiftModifier], TwoKey) :: Maybe Char
Just '@'
some keychordes cannot be represented as characters, like keyboard shortcuts:
>>>
keychord2char ([Command], CKey) :: Maybe Char
Nothing
>>>
import Data.Char
>>>
import Data.Maybe
prop> maybe True isAscii (keychord2char k) TODO replace true with redo test