Implemented but untested
Chris Pressey
3 years ago
100 | 100 |
testIsBeta1 = (isBetaReducible testApp) == True
|
101 | 101 |
testIsBeta2 = (isBetaReducible testAbs) == False
|
102 | 102 |
testIsBeta3 = (isBetaReducible (var "j")) == False
|
|
103 |
|
|
104 |
reduceOneTerm t =
|
|
105 |
if isBetaReducible t then (Right (beta t)) else destruct t
|
|
106 |
(\n -> Left (var n))
|
|
107 |
(\u v ->
|
|
108 |
case reduceOneTerm u of
|
|
109 |
Right r -> Right (app r v)
|
|
110 |
Left f ->
|
|
111 |
case reduceOneTerm v of
|
|
112 |
Right s -> Right (app u s)
|
|
113 |
Left g -> Left (app f g)
|
|
114 |
)
|
|
115 |
(\u -> Left u)
|
|
116 |
|
|
117 |
--
|
|
118 |
-- TODO: tests for that
|
|
119 |
--
|