Safe Haskell | None |
---|---|
Language | Haskell2010 |
Workflow.Types
Description
- data WorkflowF k
- = SendKeyChord [Modifier] Key k
- | SendText String k
- | SendMouseClick [Modifier] Natural MouseButton k
- | SendMouseScroll [Modifier] MouseScroll Natural k
- | GetClipboard (Clipboard -> k)
- | SetClipboard Clipboard k
- | CurrentApplication (Application -> k)
- | OpenApplication Application k
- | OpenURL URL k
- | Delay MilliSeconds k
- newtype Application' = Application {}
- type ApplicationName' = Text
- type ApplicationExecutable' = Text
- type ApplicationName = String
- type ApplicationExecutable = FilePath
- data Workflow_
- type MonadWorkflow m = (MonadFree WorkflowF m, MonadThrow m)
- type MonadWorkflow_ = MonadFree WorkflowF
- type WorkflowT = FreeT WorkflowF
- type Workflow = Free WorkflowF
- type Clipboard = String
- type Application = String
- type URL = String
- type MilliSeconds = Int
- data MouseButton
- data MouseScroll
- type KeySequence = [KeyChord]
- type KeyChord = ([Modifier], Key)
- pattern KeyChord :: [Modifier] -> Key -> KeyChord
- pattern SimpleKeyChord :: Key -> KeyChord
- data Modifier
- type Modifiers = [Modifier]
- data Key
- = MetaKey
- | HyperKey
- | ControlKey
- | CapsLockKey
- | ShiftKey
- | OptionKey
- | FunctionKey
- | GraveKey
- | MinusKey
- | EqualKey
- | DeleteKey
- | ForwardDeleteKey
- | LeftBracketKey
- | RightBracketKey
- | BackslashKey
- | SemicolonKey
- | QuoteKey
- | CommaKey
- | PeriodKey
- | SlashKey
- | TabKey
- | SpaceKey
- | ReturnKey
- | LeftArrowKey
- | RightArrowKey
- | DownArrowKey
- | UpArrowKey
- | AKey
- | BKey
- | CKey
- | DKey
- | EKey
- | FKey
- | GKey
- | HKey
- | IKey
- | JKey
- | KKey
- | LKey
- | MKey
- | NKey
- | OKey
- | PKey
- | QKey
- | RKey
- | SKey
- | TKey
- | UKey
- | VKey
- | WKey
- | XKey
- | YKey
- | ZKey
- | ZeroKey
- | OneKey
- | TwoKey
- | ThreeKey
- | FourKey
- | FiveKey
- | SixKey
- | SevenKey
- | EightKey
- | NineKey
- | EscapeKey
- | F1Key
- | F2Key
- | F3Key
- | F4Key
- | F5Key
- | F6Key
- | F7Key
- | F8Key
- | F9Key
- | F10Key
- | F11Key
- | F12Key
- | F13Key
- | F14Key
- | F15Key
- | F16Key
- | F17Key
- | F18Key
- | F19Key
- | F20Key
- modifier2key :: Modifier -> Key
- isModifierKey :: Key -> Maybe Modifier
- isAlphaNumKey :: Key -> Bool
- isAlphabeticKey :: Key -> Bool
- isNumericKey :: Key -> Bool
- displayKey :: Key -> String
Documentation
WorkflowF
platform-agnostic workflows, which can be interpreted by platform-specific bindings.
Naming: WorkflowF for "Workflow Functor".
NOTE: currently, no error codes are returned (only ()
)).
this (1) simplifies bindings and
(2) saves the user from explicitly ignoring action results (e.g. _ <- getClipboard
).
later, they can be supported,
alongside wrappers that return ()
and throw SomeException
and provide the same simple API.
since the intented usage of workflows are as user-facing
(often user-written) scripts, and
the monad that satisifes MonadWorkflow will often satisify MonadIO too,
convenient partial functions that throw a helpful error message to stdout
(the error codes should be converted to their error messages) should suffice.
and either way, is strictly better for the user than ignoring,
as the exceptions can always be caught, or not displayed.
Constructors
SendKeyChord [Modifier] Key k | press the |
SendText String k | a logical grouping for: (1) unicode support (2) efficiency and (3) debugging. sent to the current application. |
SendMouseClick [Modifier] Natural MouseButton k | click the button, some number of times, holding down the modifiers derived, make method, not constructor. sent to the current application. |
SendMouseScroll [Modifier] MouseScroll Natural k | spin the wheel, some number of units*, holding down the modifiers |
GetClipboard (Clipboard -> k) | |
SetClipboard Clipboard k | |
CurrentApplication (Application -> k) | like a getter. |
OpenApplication Application k | idempotent. like a setter. |
OpenURL URL k | |
Delay MilliSeconds k | interpreted as |
type ApplicationName' = Text Source #
type ApplicationExecutable' = Text Source #
type ApplicationName = String Source #
type ApplicationExecutable = FilePath Source #
the non-monadic subset of WorkflowF
.
i.e. all cases that return ()
, preserving the previous continuation.
Naming: "unit workflow", like "traverse_".
type MonadWorkflow m = (MonadFree WorkflowF m, MonadThrow m) Source #
abstract interface.
a monad constraint for "workflow effects"
(just like MonadState
is for "state effects").
Can be used in any monad transformer stack that handles them.
WorkflowF
holds the effects.
MonadThrow
supports:
press
, if the user's syntax is wrong- error messages from the underlying system calls (TODO e.g. Win32's
GetLastError()
)
type MonadWorkflow_ = MonadFree WorkflowF Source #
(without failability)
type Application = String Source #
type MilliSeconds = Int Source #
data MouseButton Source #
Operating systems always (?) support at least these mouse events.
Most mice have these three buttons, trackpads have left/right.
Constructors
LeftButton | |
MiddleButton | |
RightButton |
data MouseScroll Source #
Mouse wheel scrolling, vertically and horizontally.
- scrolls up when "natural scrolling" is disabled
- scrolls down when "natural scrolling" is enabled
TODO check
Constructors
ScrollTowards | |
ScrollAway | |
ScrollLeft | |
ScrollRight |
type KeySequence = [KeyChord] Source #
a sequence of key chords make up a keyboard shortcut
type KeyChord = ([Modifier], Key) Source #
represents joitly holding down all the modifiers while individually press each key down and back up.
pattern SimpleKeyChord :: Key -> KeyChord Source #
modifier keys are keys that can be "held".
NOTE the escape key tends to be "pressed", not "held", it seems. (possibly explains its behavior in your terminal emulator?)
alt
is OptionModifier
.
Constructors
MetaModifier | fake modifier: Alt on Linux/Windows, Command on OSX |
HyperModifier | fake modifier: Control on Linux/Windows, Command on OSX |
ControlModifier | |
OptionModifier | |
ShiftModifier | |
FunctionModifier |
a "cross-platform" keyboard, that has:
- all keys that exist on standard keyboards.
- plus,
MetaKey
andHyperKey
: virtual modifiers to abstract over common keyboard shortcuts.
(let me know if you want a type to support cross-platform international keyboards,
i haven't looked into it. you can still use the
platform-specific virtual-key-codes in the dependent packages:
workflow-linux
, workflow-osx
, and workflow-windows
)
Constructors
MetaKey | fake key: Alt on Linux/Windows, Command on OSX |
HyperKey | fake key: Control on Linux/Windows, Command on OSX Control/Command both have C/O/N |
ControlKey | |
CapsLockKey | |
ShiftKey | |
OptionKey | |
FunctionKey | |
GraveKey | |
MinusKey | |
EqualKey | |
DeleteKey | |
ForwardDeleteKey | |
LeftBracketKey | |
RightBracketKey | |
BackslashKey | |
SemicolonKey | |
QuoteKey | |
CommaKey | |
PeriodKey | |
SlashKey | |
TabKey | |
SpaceKey | |
ReturnKey | |
LeftArrowKey | |
RightArrowKey | |
DownArrowKey | |
UpArrowKey | |
AKey | |
BKey | |
CKey | |
DKey | |
EKey | |
FKey | |
GKey | |
HKey | |
IKey | |
JKey | |
KKey | |
LKey | |
MKey | |
NKey | |
OKey | |
PKey | |
QKey | |
RKey | |
SKey | |
TKey | |
UKey | |
VKey | |
WKey | |
XKey | |
YKey | |
ZKey | |
ZeroKey | |
OneKey | |
TwoKey | |
ThreeKey | |
FourKey | |
FiveKey | |
SixKey | |
SevenKey | |
EightKey | |
NineKey | |
EscapeKey | |
F1Key | |
F2Key | |
F3Key | |
F4Key | |
F5Key | |
F6Key | |
F7Key | |
F8Key | |
F9Key | |
F10Key | |
F11Key | |
F12Key | |
F13Key | |
F14Key | |
F15Key | |
F16Key | |
F17Key | |
F18Key | |
F19Key | |
F20Key |
modifier2key :: Modifier -> Key Source #
All modifiers are keys.
isAlphaNumKey :: Key -> Bool Source #
isAlphabeticKey :: Key -> Bool Source #
isNumericKey :: Key -> Bool Source #
displayKey :: Key -> String Source #