HORIZON HASKELLDocslts/ghc-9.14.xb2f3bfd2026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · b2f3bfd · 2026-10-11

Modulevortex-keymap-0.1.0Haskell2010

Vortex.Keymap.Effects

A keymap as a script: one expression in a pure declaration row whose operations bind keys to programs. No IO appears in the row, so a keymap script can only describe bindings; the host folds it into a KeyNode tree.

The row is indexed by the program type p. polysemy's Member cannot infer p from the row without polysemy-plugin, so a host exports its own constructors pinned to its program type:

bind :: Member (Keys (App ())) r => String -> String -> App () -> Sem r ()
bind k d p = send (Bind k d p :: Keys (App ()) (Sem r) ())

The generic constructors below are for hosts that pin p another way (a type application on send, a concrete row).

  • 4 types
  • 6 values
datadata Keys p (m :: Type -> Type) a where
#

Constructors

  • Bind :: String -> String -> p -> Keys p m ()

    bind "space f" "file picker" prog: the key path, what the infobox says, the program.

  • Prefix :: String -> String -> Sem '[Keys p] () -> Keys p m ()

    prefix "space q" "queue" body: a sub-tree with its infobox title; paths inside the body are relative to it.

  • Unbind :: String -> Keys p m ()

    Remove a binding or a whole prefix; prefixes left empty go too.

valuebind :: Member (Keys p) r => String -> String -> p -> Sem r ()
#

bind "space f" "file picker" prog: the key path, what the infobox says, the program.

valueapplyEdits :: KeyNode p -> [KeyEdit p] -> Either KeymapError (KeyNode p)
#

Apply edits in order onto a tree. Binding creates the prefixes it needs, titled by their key names until a prefix names them; binding onto a prefix replaces it; a binding in the way of a longer path is an error; unbinding a path that does not exist is a no-op.