summaryrefslogtreecommitdiff
path: root/src/compiler/SimpleEditor
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-07-27 22:06:23 +0000
committerhallgren <hallgren@chalmers.se>2014-07-27 22:06:23 +0000
commit30cda5151651e712803527b6ab4e5abc07536f2c (patch)
tree3c111f33a80fe5e1ea3e1cb40a968289a8b11425 /src/compiler/SimpleEditor
parent7eaea44386acb6b5f71806e649850629470441f8 (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/SimpleEditor')
-rw-r--r--src/compiler/SimpleEditor/Convert.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/SimpleEditor/Convert.hs b/src/compiler/SimpleEditor/Convert.hs
index 0f07bc8bf..c0f7e3946 100644
--- a/src/compiler/SimpleEditor/Convert.hs
+++ b/src/compiler/SimpleEditor/Convert.hs
@@ -6,7 +6,7 @@ import Data.List(sortBy)
import Data.Function(on)
import qualified Data.Map as Map
import Text.JSON(makeObj) --encode
-import Text.PrettyPrint(render,text,(<+>))
+import GF.Text.Pretty(render,(<+>))
import qualified Data.ByteString.UTF8 as UTF8(fromString)
@@ -124,11 +124,11 @@ convCncJment (name,jment) =
ResOper oltyp (Just lterm) -> return $ Op $ Oper lhs rhs
where
lhs = i++maybe "" ((" : "++) . render . ppTerm q 0 . unLoc) oltyp
- rhs = render (text " ="<+>ppTerm q 0 (unLoc lterm))
+ rhs = render (" ="<+>ppTerm q 0 (unLoc lterm))
ResOverload [] defs -> return $ Op $ Oper lhs rhs
where
lhs = i
- rhs = render $ text " = overload"<+>ppTerm q 0 r
+ rhs = render $ " = overload"<+>ppTerm q 0 r
r = R [(lab,(Just ty,fu)) | (L _ ty,L _ fu) <-defs]
lab = ident2label name
CncFun _ (Just ldef) pprn _ -> -- ignores printname !!