1
0
forked from GitHub/gf-core
Files
gf-core/src/GF/UseGrammar/Transfer.hs
2005-02-18 18:21:06 +00:00

44 lines
1.1 KiB
Haskell

----------------------------------------------------------------------
-- |
-- Module : (Module)
-- Maintainer : (Maintainer)
-- Stability : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/02/18 19:21:23 $
-- > CVS $Author: peb $
-- > CVS $Revision: 1.3 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
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)