From d82d607b3a176efa28e4823b5f5098afd4d3b5d8 Mon Sep 17 00:00:00 2001 From: mrkkrp Date: Sun, 7 Jul 2019 13:37:15 +0200 Subject: [PATCH] =?UTF-8?q?Implement=20=E2=80=98VarBr=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/examples/declaration/splice/quotes-out.hs | 3 +++ data/examples/declaration/splice/quotes.hs | 3 +++ src/Ormolu/Printer/Meat/Declaration/Value.hs | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 data/examples/declaration/splice/quotes-out.hs create mode 100644 data/examples/declaration/splice/quotes.hs diff --git a/data/examples/declaration/splice/quotes-out.hs b/data/examples/declaration/splice/quotes-out.hs new file mode 100644 index 0000000..117ae57 --- /dev/null +++ b/data/examples/declaration/splice/quotes-out.hs @@ -0,0 +1,3 @@ +foo = ''R + +bar = 'foo diff --git a/data/examples/declaration/splice/quotes.hs b/data/examples/declaration/splice/quotes.hs new file mode 100644 index 0000000..117ae57 --- /dev/null +++ b/data/examples/declaration/splice/quotes.hs @@ -0,0 +1,3 @@ +foo = ''R + +bar = 'foo diff --git a/src/Ormolu/Printer/Meat/Declaration/Value.hs b/src/Ormolu/Printer/Meat/Declaration/Value.hs index f1596c2..94e8b86 100644 --- a/src/Ormolu/Printer/Meat/Declaration/Value.hs +++ b/src/Ormolu/Printer/Meat/Declaration/Value.hs @@ -13,6 +13,7 @@ where import Bag (bagToList) import BasicTypes import Control.Monad +import Data.Bool (bool) import Data.Data hiding (Infix, Prefix) import Data.List (intersperse, sortOn) import Data.Text (Text) @@ -728,7 +729,9 @@ p_hsBracket = \case DecBrL NoExt decls -> quote "d" (p_hsDecls Free decls) DecBrG NoExt _ -> notImplemented "DecBrG" -- result of renamer TypBr NoExt ty -> quote "t" (located ty p_hsType) - VarBr NoExt _ _ -> notImplemented "VarBr" + VarBr NoExt isSingleQuote name -> do + txt (bool "''" "'" isSingleQuote) + p_rdrName (noLoc name) TExpBr NoExt expr -> do txt "[||" breakpoint'