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
|
-- This example has been taken from:
-- Elvira Albert and Mar{\'{\i}}a Alpuente and Michael Hanus and Germ{\'{a}}n Vidal
-- A Partial Evaluation Framework for {C}urry Programs
-- LPAR'99
-- Example 5 of LPAR'99 paper:
data ABC = A | B | C
-- f eval flex
-- f A B = C
f a b = fcase a of
A -> fcase b of
B -> C
-- g eval rigid
-- g B C = B
g b c = case b of
B -> case c of
C -> B
-- h eval flex
-- h C = C
h c = fcase c of C -> C
goal x y z = PEVAL (f x (g y (h z)))
main = (goal x y z, x, y, z) where x, y, z free
|