From 36b4c04ffdcde6a30cfbf20ff7b8279c20ed1702 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 27 Nov 2019 21:50:55 -0800 Subject: Use `[|..|]` syntax to simplify Emoji.TH. --- src/Text/Pandoc/Emoji/TH.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc/Emoji/TH.hs') diff --git a/src/Text/Pandoc/Emoji/TH.hs b/src/Text/Pandoc/Emoji/TH.hs index a2e11e430..bf3ed0c16 100644 --- a/src/Text/Pandoc/Emoji/TH.hs +++ b/src/Text/Pandoc/Emoji/TH.hs @@ -1,5 +1,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskellQuotes #-} {- | Module : Text.Pandoc.Emoji.TH Copyright : Copyright (C) 2019 John MacFarlane @@ -24,12 +25,11 @@ genEmojis fp = do bs <- runIO $ B.readFile fp case eitherDecode bs of Left e -> error e - Right (emoji :: [Emoji]) -> - return $ ListE - [TupE [ LitE (StringL alias), - LitE (StringL txt) ] - | Emoji txt aliases <- emoji - , alias <- aliases] + Right (emoji :: [Emoji]) -> [| emojis |] + where emojis = [ (alias, txt) + | Emoji txt aliases <- emoji + , alias <- aliases + ] data Emoji = Emoji String [String] deriving Show -- cgit v1.2.3