summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2015-04-07 14:51:52 +0000
committerhallgren <hallgren@chalmers.se>2015-04-07 14:51:52 +0000
commitd24953846904166898b92f994964f8e898cfe6aa (patch)
tree58fd76fc106c18c40fe4630c2e80402f8855a0e0 /src
parent6e81383231d605253c2f3195c3d51b480b4d19fa (diff)
GF.Compile.ConcreteToHaskell: some documentation
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Compile/ConcreteToHaskell.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/GF/Compile/ConcreteToHaskell.hs b/src/compiler/GF/Compile/ConcreteToHaskell.hs
index a2106a2f4..0b55a959d 100644
--- a/src/compiler/GF/Compile/ConcreteToHaskell.hs
+++ b/src/compiler/GF/Compile/ConcreteToHaskell.hs
@@ -1,4 +1,5 @@
-module GF.Compile.ConcreteToHaskell where
+-- | Translate concrete syntax to Haskell
+module GF.Compile.ConcreteToHaskell(concretes2haskell,concrete2haskell) where
import Data.List(sort,sortBy)
import Data.Function(on)
import qualified Data.Map as M
@@ -18,14 +19,19 @@ import GF.Infra.Option
import GF.Compile.Compute.ConcreteNew(normalForm,resourceValues)
import Debug.Trace
+-- | Generate Haskell code for the all concrete syntaxes associated with
+-- the named abstract syntax in given the grammar.
concretes2haskell opts absname gr =
[(cncname,concrete2haskell opts gr cenv absname cnc cncmod)
| let cenv = resourceValues opts gr,
cnc<-allConcretes gr absname,
- let cncname = render cnc ++ ".hs"
+ let cncname = render cnc ++ ".hs" :: FilePath
Ok cncmod = lookupModule gr cnc
]
+-- | Generate Haskell code for the given concrete module.
+-- The only options that make a difference are
+-- @-haskell=noprefix@ and @-haskell=variants@.
concrete2haskell opts gr cenv absname cnc modinfo =
renderStyle style{lineLength=80,ribbonsPerLine=1} $
haskPreamble va absname cnc $$ "" $$