-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunction.hs
69 lines (55 loc) · 1.67 KB
/
Function.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{-|
e.g.
1. 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]
@
2. 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 supports `Edit`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 of @emacsEdit@, assuming no partial functions.
* serialize @emacsEdit@ into a mapping,
from which `elisp` source can be extracted.
(also see the source of "Enumerate.Function.Example")
-}
module Enumerate.Function
( module Enumerate.Function.Types
, module Enumerate.Function.Reify
, module Enumerate.Function.Map
, module Enumerate.Function.Invert
) where
import Enumerate.Function.Types
import Enumerate.Function.Reify
import Enumerate.Function.Map
import Enumerate.Function.Invert