haskell - Caching intermediate states of a series of computations -


So, this is a solid idea: I'm writing a Scrabble Game A, and in the process of calculating all possible steps, However, I have to calculate a bunch of intermediate values ​​of the board square. I want to cache these intermediate values ​​in a way that is composable.

So, more logical:

Without caching, I have f :: w a - & gt; WB , G :: WB - & gt; WC , where w can be a factor, but in my case Scrabble board is the datatype. After adding i caching, I have f ':: m (wa) - & Gt; M (wb) , and g ':: m' (w b) - & gt; M '(WC) , where m and m are monad datat type * cached state but now i < Can not write code> f ' and g'

I'm not super familiar with the Moned Transformer, but it seems like I used it here, depending on the frequent lift my monedic functions are required. That's how deep the cached-functions were in the series of compositions. Like if I had a f 'g' h ', h' my execution would require some lift lift up . Am I off-base here? In theory, f ', g , and h are unrelated, and there is no need to know about each other's cached status Is there a better way of reflecting this freedom?

* I do not think they have to be monitored, because I do not modify other functions to m and m '. They are 'private' for f ' and g .

In general, m (w) -> M (wb) and m '(w b) - & gt; is a m a function (or other denomination joke) and

m ' is "indicated" (I.e. this is a refund / pure function), then you m (w) -> M (M '(WC)) .

Forward if m and m ' and both of them have a common mood (i.e. ma -> gt; ta < / Code> and m 'a - & gt; ta is present), then you can use those lifts and a type of structure m (v) - & Gt; T (WC) .

Freedom and composition competitiveness goals - both are good - but for writing two things, they are "matching shapes", which do not let them independently separate.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -