带参考的Haskell数据类型

时间:2013-10-14 22:25:59

标签: haskell reference mutable suffix-tree state-monad

我正在实现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类型声明中?

0 个答案:

没有答案