0

我在 HXT 库上看到,在我的终端提示符上有两个用于发短信的功能,它们是:

withTraceLevel

traceMsg

第一个函数“withTraceLevel”就像一个魅力,但第二个函数在我的代码上不起作用,我错过了什么吗?

我的代码示例:

procIntersection = proc it -> do
            set1 <- (getChildren >>> withTraceLevel 5 traceTree >>> traceMsg 1 "*********************************") -< it
            returnA -< Intersection { setI1 = OWLNothing, setI2 = OWLNothing{--set2--} }

输出 :

content of:
============


---XTag "rdf:Description"

   |   "rdf:about"="http://www.xfront.com/owl/ontologies/camera/#Body"

content of:

============


---XTag "owl:Restriction"

    |

    +---XTag "owl:onProperty"
    |   |   "rdf:resource"="http://www.xfront.com/owl/ontologies/camera/#shutter-speed"
    |
    +---XTag "owl:cardinality"
      |   "rdf:datatype"="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
      |
      +---XText "0"




content of:

============


---XTag "rdf:Description"

 |   "rdf:about"="http://www.xfront.com/owl/ontologies/camera/#Camera"




content of:

============


---XTag "owl:Restriction"

   |

   +---XTag "owl:onProperty"

   |   |   "rdf:resource"="http://www.xfront.com/owl/ontologies/camera/#viewFinder"

   |

   +---XTag "owl:hasValue"

       |   "rdf:resource"="http://www.xfront.com/owl/ontologies/camera/#ThroughTheLens"

通常,在第二个“内容”之后应该是一行:*********** 但是该行没有出现在那里!

4

1 回答 1

2

withTraceLevel仅设置您作为第二个参数提供的箭头的跟踪级别。

在下面的代码中,withTraceLevel仅在traceTree执行期间启用跟踪并设置级别,而不是其余的

withTraceLevel 5 traceTree >>> traceMsg 1 "bla bla"

试试这个

withTraceLevel 5 (traceTree >>> traceMsg 1 "bla bla")

查看解释器中发生了什么:

$ ghci
Prelude> :m +Text.XML.HXT.Core Text.XML.HXT.Arrow.XmlState.TraceHandling
Prelude ...> runX $ withTraceLevel 2 $ traceMsg 1 "hi!"
Loading package array-0.4.0.1 ... linking ... done.
Loading ...
-- (1) hi!
[NTree (XTag "/" []) []]
于 2014-05-09T17:48:34.940 回答