mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-10 13:29:32 -06:00
36 lines
922 B
Plaintext
36 lines
922 B
Plaintext
AR 5/3/2011
|
|
|
|
Example on using GADT and composOp in transfer.
|
|
|
|
To compile:
|
|
|
|
make
|
|
|
|
To test:
|
|
|
|
echo "this expensive boring wine is warm" | ./VeryFoods
|
|
this expensive very boring wine is warm
|
|
|
|
echo "deze dure wijn is saai" | ./VeryFoods
|
|
deze dure wijn is erg saai
|
|
|
|
Functionality: wraps every occurrence of "boring" with "very".
|
|
|
|
This is implemented with a function that needs only two cases: one for "Boring" and another
|
|
for the rest of trees. On the method, see
|
|
|
|
B. Bringert and A. Ranta.
|
|
A Pattern for Almost Compositional Functions.
|
|
Journal of Functional Programming, 18(5-6), pp. 567-598, 2008.
|
|
http://www.cse.chalmers.se/alumni/bringert/publ/composOp-jfp/composOp-jfp.pdf
|
|
|
|
Source code:
|
|
|
|
VeryFoods.hs -- main Haskell module, hand-written
|
|
Makefile
|
|
Foods.gf, FoodsEng.gf, FoodsDut.gf -- from GF/contrib/summerschool/foods/
|
|
|
|
Foods.hs and Foods.pgf are generated by 'make'.
|
|
|
|
|