mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 13:09:33 -06:00
24 lines
511 B
Haskell
24 lines
511 B
Haskell
{-# OPTIONS_GHC -fglasgow-exts #-}
|
|
module Main where
|
|
|
|
import PGF
|
|
import Foods
|
|
|
|
-- example of using GADT: turn every occurrence of "boring" to "very boring"
|
|
|
|
main = do
|
|
pgf <- readPGF "Foods.pgf"
|
|
interact (doVery pgf)
|
|
|
|
doVery pgf s = case parseAllLang pgf (startCat pgf) s of
|
|
(l,t:_):_ -> unlines $ return $ linearize pgf l $ gf $ veryC $ fg t
|
|
|
|
veryC :: GComment -> GComment
|
|
veryC = very
|
|
|
|
very :: forall a. Foods.Tree a -> Foods.Tree a
|
|
very t = case t of
|
|
GBoring -> GVery GBoring
|
|
_ -> composOp very t
|
|
|