[Haskell-beginners] hClose: illegal operation (handle is finalized) and/or <<loop>>

Felipe Lessa felipe.lessa at gmail.com
Tue Aug 17 19:57:24 EDT 2010


On Tue, Aug 17, 2010 at 8:39 PM, Travis Erdman <traviserdman at yahoo.com> wrote:
> calcTree (Node oldData oldsubtree) input = Node newData recurseChildren
>   where
>       {-calculate newData from oldData and input-}
>       recurseChildren = if {BOOLEANS} then oldsubtree else map (\old -> calcTree old input) oldsubtree
>
> And, in words:  if certain conditions become true, there will
> be no change in any decedent node from the current node (ie all
> newData = oldData, and tree structure never changes), so rather
> than waste exponential time traversing all the decedent nodes,
> I'd like to just re-use the ones I already have, as they are
> identical.  This is "pruning" the tree.  If I remove this
> pruning, the "<<LOOP>>" objection ceases and the code executes
> as expected ... except it takes lots longer than it should,
> because there are usually lots of oppt'ys for pruning, and I'd
> rather not explicitly traverse all of them.
>
> How can I make this work?

Perhaps in your {BOOLEANS} you are referring to
'recurseChildren', which in turn needs the {BOOLEANS}?

HTH!

--
Felipe.


More information about the Beginners mailing list