diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-11-27 21:50:55 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-11-27 21:50:55 -0800 |
commit | 36b4c04ffdcde6a30cfbf20ff7b8279c20ed1702 (patch) | |
tree | 11c67b246cd6fbba2beed2f8878f1b649dcc280c /src/Text/Pandoc/Emoji | |
parent | d88015e03e2010c3209d549697e1c4f4f5c903a2 (diff) | |
download | pandoc-36b4c04ffdcde6a30cfbf20ff7b8279c20ed1702.tar.gz |
Use `[|..|]` syntax to simplify Emoji.TH.
Diffstat (limited to 'src/Text/Pandoc/Emoji')
-rw-r--r-- | src/Text/Pandoc/Emoji/TH.hs | 12 |
1 files changed, 6 insertions, 6 deletions
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 |