From 22f6f175f0461600e0f1f229a7c06034335829d3 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Tue, 8 Feb 2011 15:01:01 -0800 Subject: [PATCH] use #define to avoid repeating #if, etc --- Yesod/Form.hs | 53 +++++++++++--------------------------------- Yesod/Form/Fields.hs | 34 +++++++++------------------- 2 files changed, 23 insertions(+), 64 deletions(-) diff --git a/Yesod/Form.hs b/Yesod/Form.hs index 7944dc5c..8db1f2ef 100644 --- a/Yesod/Form.hs +++ b/Yesod/Form.hs @@ -64,6 +64,11 @@ import Control.Arrow ((&&&)) import Data.List (group, sort) import Data.Monoid (mempty) +#if __GLASGOW_HASKELL__ >= 700 +#define HAMLET hamlet +#else +#define HAMLET $hamlet +#endif -- | Display only the actual input widget code, without any decoration. fieldsToPlain :: FormField sub y a -> Form sub y a fieldsToPlain = mapFormXml $ mapM_ fiInput @@ -73,12 +78,7 @@ fieldsToPlain = mapFormXml $ mapM_ fiInput fieldsToTable :: FormField sub y a -> Form sub y a fieldsToTable = mapFormXml $ mapM_ go where - go fi = -#if __GLASGOW_HASKELL__ >= 700 - [hamlet| -#else - [$hamlet| -#endif + go fi = [HAMLET|