summaryrefslogtreecommitdiff
path: root/src/GF/Grammar/Lockfield.hs
diff options
context:
space:
mode:
authoraarne <unknown>2005-02-08 15:35:58 +0000
committeraarne <unknown>2005-02-08 15:35:58 +0000
commit4fd0c636f8590bf800715f2598e54ccc22c99b90 (patch)
tree6415ac64c06f2cf27bce3b5b154eeb58f18d3776 /src/GF/Grammar/Lockfield.hs
parent6fe9cca0ff4f0730de4f254482cb68ce494f58d7 (diff)
unlexer concat
Diffstat (limited to 'src/GF/Grammar/Lockfield.hs')
-rw-r--r--src/GF/Grammar/Lockfield.hs37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/GF/Grammar/Lockfield.hs b/src/GF/Grammar/Lockfield.hs
new file mode 100644
index 000000000..fb9043b00
--- /dev/null
+++ b/src/GF/Grammar/Lockfield.hs
@@ -0,0 +1,37 @@
+----------------------------------------------------------------------
+-- |
+-- Module : (Module)
+-- Maintainer : (Maintainer)
+-- Stability : (stable)
+-- Portability : (portable)
+--
+-- > CVS $Date $
+-- > CVS $Author $
+-- > CVS $Revision $
+--
+-- Creating and using lock fields in reused resource grammars.
+-----------------------------------------------------------------------------
+
+module Lockfield where
+
+import Grammar
+import Ident
+import Macros
+import PrGrammar
+
+import Operations
+
+-- AR 8/2/2005 detached from compile/MkResource
+
+lockRecType :: Ident -> Type -> Err Type
+lockRecType c t = plusRecType t $ RecType [(lockLabel c, RecType [])]
+
+unlockRecord :: Ident -> Term -> Err Term
+unlockRecord c ft = do
+ let (xs,t) = termFormCnc ft
+ t' <- plusRecord t $ R [(lockLabel c, (Just (RecType []),R []))]
+ return $ mkAbs xs t'
+
+lockLabel :: Ident -> Label
+lockLabel c = LIdent $ "lock_" ++ prt c ----
+