[Haskell-cafe] Haskell idioms for hierarchical memory modeling ?

Marc Weber marco-oweber at gmx.de
Mon May 26 09:02:01 EDT 2008

> 1) How to model node vector processing and node state? Node receives input
> and produces output and can change its state by adding new category to Node
> CM. Will State monad help to 'thread' node state between inputs? I don't see
> how.
> State monad encapsulates state transition function:
> State s a = State (\s -> a, s)

This is typically done by 
step :: NewInput -> State StateOfNodes ()
step input = do old <- ask
                let newState = doSomithingWithStateAndInput input old
                put newState
                return ()
Of course there are shortcuts such as modify etc

() because the only thing you want to return here is the new state I
guess. So maybe its not worth even using State. You must think of it as
kind of closure.

> 2) How to traverse classifier tree (MT) so inputs from bottom level nodes
> could flow up to a top node through all nodes at all intermediate levels? In
> contrast to a 'normal' tree where  all variations of tree traversals start
> at root node, classifier tree must be traversed starting from bottom level
> nodes.
I'm haven't read all of your text.. You should think about how to
represent your tree in haskell. Maybe you want to have a look at hgl
(haskell graph library) beeing distributed with ghc-*-extra sources.
There is a nice introduction. At least it gives you one solution on how
it could be done.. But which way is the best / fastest one? Don't know..
Maybe even reuse a already existing library :)

> 4) Most important: In what direction should I look as a Haskell newbie to
> find answers to these and similar questions? Should I build my own monad to
> traverse this tree, what other standard monads may help? What combinator
> libraries should I learn? Will I need Arrows (that at the moment I know only
> name and nothing more about)?
Arrows? Haven't used them myself yet.. But you are right.. XML
transformation libs (one is using arrows) may be a good source of
knowldge es well (maybe kind of overkill as well)
I guess asking here is the best thing you could have done.
I hope you'll get some replies with more relevant information.

Searching haskell.org only gives one match:
(I haven't read it)
is the other most commonly used source of finding aready existing code
(There is package about nn)

Should your nn also support kind of learning by giving feedback?

Marc Weber

More information about the Haskell-Cafe mailing list