我正在实现 Ukkonen 的算法,它要求树的所有叶子都包含对同一整数的引用,我在 Haskell 中这样做以了解有关该语言的更多信息。但是,我很难写出执行此操作的数据类型。
-- Node has children, indexes of info on the edge
-- to it, and an optional suffix link.
-- Leaf has a beginning index of the info, but the
-- end index is always an incrementing variable index.
data STree = Node [STree] (Int, Int) (Maybe STree)
| Leaf (Int, ??? )
如何将引用放在Leaf
类型声明中?