我正在实现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, ??? )
Run Code Online (Sandbox Code Playgroud)
如何将引用放在Leaf
类型声明中?
在haskell图表中,如何更改轴的范围?它似乎与镜头和视口有关,但作为Haskell的初学者,我很难阅读API:
http://hackage.haskell.org/package/Chart-0.14/docs/Graphics-Rendering-Chart-Axis-Types.html
谢谢你的帮助!
我对Haskell比较陌生,这是我第一次使用monad变换器.我真的很感激一些帮助.
runQuery :: Pipe -> Query -> ActionM (Either Failure [Document])
runQuery pipe query = access pipe master "nutrition" (find query >>= rest)
main = do
pipe <- runIOE $ connect $ host "127.0.0.1"
scotty 3000 $ do
post "/" $ do
b <- body
let user :: Either String User = eitherDecode b
case user of
Left err -> text . pack $ "Could not decode the user:" ++ err ++ ":\n" ++ (show b)
Right u -> do …
Run Code Online (Sandbox Code Playgroud) haskell ×3
haskell-lens ×1
monads ×1
mongodb ×1
mutable ×1
reference ×1
scotty ×1
state-monad ×1
suffix-tree ×1