1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Move encloseIf back into Data.Core.Pretty.

This commit is contained in:
Rob Rix 2019-07-19 11:52:17 -04:00
parent 0115512f58
commit ebafd644d3
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 4 additions and 5 deletions

View File

@ -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

View File

@ -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 @_@.