mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Convert from Text.PrettyPrint to GF.Text.Pretty
All compiler modules now use GF.Text.Pretty instead of Text.PrettyPrint
This commit is contained in:
@@ -29,7 +29,7 @@ import GF.Grammar.Lookup
|
||||
import Debug.Trace
|
||||
import Data.List(intersperse)
|
||||
import Control.Monad (liftM, liftM2)
|
||||
import Text.PrettyPrint
|
||||
import GF.Text.Pretty
|
||||
|
||||
-- for debugging
|
||||
tracd m t = t
|
||||
|
||||
@@ -23,7 +23,7 @@ import GF.Grammar
|
||||
import GF.Grammar.Predef
|
||||
|
||||
import qualified Data.Map as Map
|
||||
import Text.PrettyPrint
|
||||
import GF.Text.Pretty
|
||||
import Data.Char (isUpper,toUpper,toLower)
|
||||
|
||||
-- predefined function type signatures and definitions. AR 12/3/2003.
|
||||
@@ -140,4 +140,4 @@ mapStr ty f t = case (ty,t) of
|
||||
mapField (mty,te) = case mty of
|
||||
Just ty -> (mty,mapStr ty f te)
|
||||
_ -> (mty,te)
|
||||
-}
|
||||
-}
|
||||
|
||||
@@ -33,7 +33,7 @@ import GF.Compile.Compute.AppPredefined
|
||||
import Data.List (nub) --intersperse
|
||||
--import Control.Monad (liftM2, liftM)
|
||||
import Control.Monad.Identity
|
||||
import Text.PrettyPrint
|
||||
import GF.Text.Pretty
|
||||
|
||||
----import Debug.Trace
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import GF.Grammar.Lookup
|
||||
import GF.Grammar.Predef
|
||||
import GF.Data.Operations
|
||||
import Data.List (intersect)
|
||||
import Text.PrettyPrint
|
||||
import GF.Text.Pretty
|
||||
|
||||
normalForm :: SourceGrammar -> Term -> Term
|
||||
normalForm gr t = value2term gr [] (eval gr [] t)
|
||||
@@ -65,7 +65,7 @@ eval gr env (ImplArg t) = VImplArg (eval gr env t)
|
||||
eval gr env (Table p res) = VTblType (eval gr env p) (eval gr env res)
|
||||
eval gr env (RecType rs) = VRecType [(l,eval gr env ty) | (l,ty) <- rs]
|
||||
eval gr env t@(ExtR t1 t2) =
|
||||
let error = VError (show (text "The term" <+> ppTerm Unqualified 0 t <+> text "is not reducible"))
|
||||
let error = VError (show ("The term" <+> ppTerm Unqualified 0 t <+> "is not reducible"))
|
||||
in case (eval gr env t1, eval gr env t2) of
|
||||
(VRecType rs1, VRecType rs2) -> case intersect (map fst rs1) (map fst rs2) of
|
||||
[] -> VRecType (rs1 ++ rs2)
|
||||
|
||||
@@ -33,7 +33,7 @@ import GF.Compile.Compute.AppPredefined
|
||||
|
||||
import Data.List (nub,intersperse)
|
||||
import Control.Monad (liftM2, liftM)
|
||||
import Text.PrettyPrint
|
||||
import GF.Text.Pretty
|
||||
|
||||
----import Debug.Trace
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
|
||||
module GF.Compile.Compute.Predef(predef,predefName,delta) where
|
||||
|
||||
import Text.PrettyPrint(render,hang,text)
|
||||
import GF.Text.Pretty(render,hang)
|
||||
import qualified Data.Map as Map
|
||||
import Data.Array(array,(!))
|
||||
import Data.List (isInfixOf)
|
||||
@@ -154,6 +154,6 @@ string s = case words s of
|
||||
|
||||
swap (x,y) = (y,x)
|
||||
|
||||
bug msg = ppbug (text msg)
|
||||
bug msg = ppbug msg
|
||||
ppbug doc = error $ render $
|
||||
hang (text "Internal error in Compute.Predef:") 4 doc
|
||||
hang "Internal error in Compute.Predef:" 4 doc
|
||||
|
||||
Reference in New Issue
Block a user