Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
emacsEdit
doesn'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
emacsEdit
maps every editing action to some keybinding, which asserts that the relevant application supportsEdit
ing in its entirety. (e.g.Emacs
can,Chrome
can't); i.e. it's is surjective. - detect whether
emacsEdit
is actually total; i.e. free of bottoms. Haskell's exhaustivity checker (enable `-Wall`) can verify the totality ofemacsEdit
, assuming no partial functions. - serialize
emacsEdit
into a mapping, from whichelisp
source 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