如果我們把 Lexer.hs 中的 translateLoc 和 update 改成
import Debug.Trace (trace)
...
translateLoc (TsToken (L loc x) rest) = TsToken (L (update' loc x) x) (translateLoc rest)
where
update' NoLoc x = NoLoc
update' before@(Loc start (Pos path l c co)) x = result'
where result = Loc start (Pos path l (c + 1) (co + 1))