mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-04 16:52:50 -06:00
Added treatment of transfer modules. Aggregation is an example.
This commit is contained in:
29
src/GF/UseGrammar/Transfer.hs
Normal file
29
src/GF/UseGrammar/Transfer.hs
Normal file
@@ -0,0 +1,29 @@
|
||||
module Transfer where
|
||||
|
||||
import Grammar
|
||||
import Values
|
||||
import AbsCompute
|
||||
import qualified GFC
|
||||
import LookAbs
|
||||
import MMacros
|
||||
import TypeCheck
|
||||
|
||||
import Ident
|
||||
import Operations
|
||||
|
||||
import Monad
|
||||
|
||||
-- linearize, parse, etc, by transfer. AR 9/10/2003
|
||||
|
||||
doTransfer :: GFC.CanonGrammar -> Ident -> Tree -> Err Tree
|
||||
doTransfer gr tra t = do
|
||||
cat <- liftM snd $ val2cat $ valTree t
|
||||
f <- lookupTransfer gr tra cat
|
||||
e <- compute gr $ App f $ tree2exp t
|
||||
annotate gr e
|
||||
|
||||
useByTransfer :: (Tree -> Err a) -> GFC.CanonGrammar -> Ident -> (Tree -> Err a)
|
||||
useByTransfer lin gr tra t = doTransfer gr tra t >>= lin
|
||||
|
||||
mkByTransfer :: (a -> Err [Tree]) -> GFC.CanonGrammar -> Ident -> (a -> Err [Tree])
|
||||
mkByTransfer parse gr tra s = parse s >>= mapM (doTransfer gr tra)
|
||||
Reference in New Issue
Block a user