我有两个函数,但其中一个函数只能从另一个函数调用,所以我想内联辅助函数。我的代码如下所示:
data PoS = N | V | Adj | Adv | Phr
posEntity :: Parser PoS
posEntity =
do pos <- string "N." <|>
string "V." <|>
string "Adj." <|>
string "Adv." <|>
string "Phr."
return (posToPoS pos)
<?> "part of speech"
posToPoS pos
| pos == "N." = N
| pos == "V." = V
| pos == "Adj." = Adj
| pos == "Adv." = Adv
| pos == "Phr." = Phr
显然 posToPoS 应该被内联,但我不确定做这样的事情所需的语法。
谢谢!