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:
parent
0115512f58
commit
ebafd644d3
@ -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
|
||||
|
@ -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 @_@.
|
||||
|
Loading…
Reference in New Issue
Block a user