| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Enumerate.Function
Description
e.g.
- given:
data Edit = Edit Action Slice Region deriving (Show,Read,Eq,Ord,Generic,Enumerable) data Action = Transpose | Copy | Delete deriving (Show,Read,Eq,Ord,Enum,Bounded,Generic,Enumerable) data Slice = Whole | Backwards | Forwards deriving (Show,Read,Eq,Ord,Enum,Bounded,Generic,Enumerable) data Region = Character | Token | Line deriving (Show,Read,Eq,Ord,Enum,Bounded,Generic,Enumerable)
we can enumerate every possible editing action:
> enumerated :: [Edit]
- given a mapping to keyboard shortcuts within emacs:
type KeyBinding = [String] emacsEdit :: Edit -> KeyBinding
the `enumerate-function` package can:
- verify that
emacsEditdoesn't map different editing actions to the same keybindings, which would mean that one would shadow the other i.e. it has no collisions; i.e. it's is injective. - TODO verify that
emacsEditmaps every editing action to some keybinding, which asserts that the relevant application supportsEditing in its entirety. (e.g.Emacscan,Chromecan't); i.e. it's is surjective. - detect whether
emacsEditis actually total; i.e. free of bottoms. Haskell's exhaustivity checker (enable `-Wall`) can verify the totality ofemacsEdit, assuming no partial functions. - serialize
emacsEditinto a mapping, from whichelispsource can be extracted.
(also see the source of Enumerate.Function.Example)
Documentation
module Enumerate.Function.Types
module Enumerate.Function.Reify
module Enumerate.Function.Map
module Enumerate.Function.Invert