diff options
| author | hallgren <hallgren@chalmers.se> | 2014-07-27 22:06:23 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-07-27 22:06:23 +0000 |
| commit | 30cda5151651e712803527b6ab4e5abc07536f2c (patch) | |
| tree | 3c111f33a80fe5e1ea3e1cb40a968289a8b11425 /src/compiler/GF/Infra/Ident.hs | |
| parent | 7eaea44386acb6b5f71806e649850629470441f8 (diff) | |
Introducing GF.Text.Pretty for more concise pretty printers and GF.Infra.Location for modularity
GF.Text.Pretty provides the class Pretty and overloaded versions of the pretty
printing combinators in Text.PrettyPrint, allowing pretty printable values to
be used directly instead of first having to convert them to Doc with functions
like text, int, char and ppIdent. Some modules have been converted to use
GF.Text.Pretty, but not all. Precedences could be added to simplify the pretty
printers for terms and patterns.
GF.Infra.Location contains the types Location and L, factored out from
GF.Grammar.Grammar, and the class HasSourcePath. This allowed the import
of GF.Grammar.Grammar to be removed from GF.Infra.CheckM, making it more
like a pure library module.
Diffstat (limited to 'src/compiler/GF/Infra/Ident.hs')
| -rw-r--r-- | src/compiler/GF/Infra/Ident.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/GF/Infra/Ident.hs b/src/compiler/GF/Infra/Ident.hs index 390c5ba84..272efca03 100644 --- a/src/compiler/GF/Infra/Ident.hs +++ b/src/compiler/GF/Infra/Ident.hs @@ -13,7 +13,7 @@ ----------------------------------------------------------------------------- module GF.Infra.Ident (-- * Identifiers - Ident, ident2utf8, showIdent, ppIdent, prefixIdent, + Ident, ident2utf8, showIdent, prefixIdent, identS, identC, identV, identA, identAV, identW, argIdent, isArgIdent, getArgIndex, varStr, varX, isWildIdent, varIndex, @@ -31,7 +31,7 @@ import qualified Data.ByteString.Char8 as BS(append,isPrefixOf) -- UTF-8-encoded bytestrings! import Data.Char(isDigit) import PGF.Internal(Binary(..)) -import Text.PrettyPrint(Doc,text) +import GF.Text.Pretty -- | the constructors labelled /INTERNAL/ are @@ -81,8 +81,7 @@ ident2raw = Id . ident2utf8 showIdent :: Ident -> String showIdent i = unpack $! ident2utf8 i -ppIdent :: Ident -> Doc -ppIdent = text . showIdent +instance Pretty Ident where pp = pp . showIdent identS :: String -> Ident identS = identC . rawIdentS |
