From 8e4e8da105547abec4fe27e837d13bf45d78e31b Mon Sep 17 00:00:00 2001 From: hallgren Date: Mon, 9 Feb 2015 16:24:33 +0000 Subject: Translating linearization functions to Haskell: support for variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By adding the flag -haskell=variants to the command line, GF will now generate linearization functions in Haskell that support variants. Variants are represented as lists in Haskell. Variants inside pre { ... } expressions are still ignored. TODO: apply some monad laws to generate more compact code (using an intermediate representation of the generated Haskell code, instead of pretty printing directly from the GF code). --- src/compiler/GF/Infra/Option.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/compiler/GF/Infra') diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs index 85e02e305..563fb017e 100644 --- a/src/compiler/GF/Infra/Option.hs +++ b/src/compiler/GF/Infra/Option.hs @@ -126,7 +126,7 @@ data CFGTransform = CFGNoLR deriving (Show,Eq,Ord) data HaskellOption = HaskellNoPrefix | HaskellGADT | HaskellLexical - | HaskellConcrete + | HaskellConcrete | HaskellVariants deriving (Show,Eq,Ord) data Warning = WarnMissingLincat @@ -521,7 +521,8 @@ haskellOptionNames = [("noprefix", HaskellNoPrefix), ("gadt", HaskellGADT), ("lexical", HaskellLexical), - ("concrete", HaskellConcrete)] + ("concrete", HaskellConcrete), + ("variants", HaskellVariants)] -- | This is for bacward compatibility. Since GHC 6.12 we -- started using the native Unicode support in GHC but it -- cgit v1.2.3