diff --git a/semantic-core/src/Data/Core/Pretty.hs b/semantic-core/src/Data/Core/Pretty.hs index 92280c0fd..f53cb1aee 100644 --- a/semantic-core/src/Data/Core/Pretty.hs +++ b/semantic-core/src/Data/Core/Pretty.hs @@ -39,6 +39,10 @@ symbol = annotate (Pretty.color Pretty.Yellow) strlit = annotate (Pretty.colorDull Pretty.Green) primitive = keyword . mappend "#" +encloseIf :: Monoid m => Bool -> m -> m -> m -> m +encloseIf True l r x = l <> x <> r +encloseIf False _ _ x = x + type Prec = Int data Style = Unicode | Ascii diff --git a/semantic-core/src/Data/Name.hs b/semantic-core/src/Data/Name.hs index d7f644669..52dea6b19 100644 --- a/semantic-core/src/Data/Name.hs +++ b/semantic-core/src/Data/Name.hs @@ -10,7 +10,6 @@ module Data.Name , reservedNames , isSimpleCharacter , needsQuotation -, encloseIf ) where import qualified Data.Char as Char @@ -53,10 +52,6 @@ reservedNames = [ "#true", "#false", "let", "#frame", "if", "then", "else" needsQuotation :: User -> Bool needsQuotation u = HashSet.member (unpack u) reservedNames || Text.any (not . isSimpleCharacter) u -encloseIf :: Monoid m => Bool -> m -> m -> m -> m -encloseIf True l r x = l <> x <> r -encloseIf False _ _ x = x - -- | A ‘simple’ character is, loosely defined, a character that is compatible -- with identifiers in most ASCII-oriented programming languages. This is defined -- as the alphanumeric set plus @$@ and @_@.