| glguy | i guess you haven't gotten that far before the error hit? |
| sciolizer | glguy: I don't. If I wanted it to calculate, I would do main = print $ run fib $ 5 |
| glguy | not "constA 5 >>> fib"? |
| sciolizer | @hoogle constA |
| lambdabot | No matches found |
| sciolizer | glguy: What is constA? |
| nmessenger | I don't really understand the code, but wouldn't fib's count be _|_ since it calls itself recursively? |
| glguy | that could be HXT specific... HXT is the only time I use arrows |
| sciolizer | glguy: oh, ok |
| glguy | I don't understand what the "run" field is for |
| sciolizer | glguy: run "unlifts" the Arrow. |
| nmessenger | glguy: it's the "unpacker" the way the "runState" unpacks a State monad's underlying function. |
| sciolizer | nmessenger: count should return the number of explicit/implicit >>>'s. |
| glguy | sure, but then how does that affect the count ah but you don't know that because you haven't done the recursion |
| nmessenger | sciolizer: right, and since fib has some (>>>)'s, and is also defined in terms of itself, count should be infinite. |
| glguy | sciolizer: constA x is an arrow that ignores its input and returns x |
| nmessenger | I'm not sure how to do a "running total of (>>>)'s so far", but it would require an input |
| sciolizer | glguy: ok |
| sjanssen | fantasma: no, both dons and I have darcs.haskell.org accounts, the permissions are set such that anyone in the "darcs" group can write to the repo |
| nmessenger | sciolizer: try "let x = x >>> x in count arr x :: AppCounter", should also blow the stack. |
| sciolizer | nmessenger: maybe I just don't understand this yet. My thinking is that since the count field and the run field are independent, then Haskell's lazy evaluation will prevent any function composition (and therefore recursion) from ever happening. |
| nmessenger | er, AppCounter () () |
| sjanssen | sciolizer: you can do some dynamic programming with monads |
| nmessenger | sciolizer: but you're trying to print an Int, so Haskell has to evaluate that Int, which causes the stack explosion. |
| sciolizer | sjanssen: any examples? |
| nmessenger | sciolizer: try that example in the REPL |
| sciolizer | nmessenger: uh, type error |
| action | nmessenger tries |
| nmessenger | tries |
| sjanssen | sciolizer: I don't have any canned examples. The idea is to use a state monad that carries around a Map of function results |
| sciolizer | sjanssen: ok. I thought of that before (a few months ago), but ran into a wall somewhere. Maybe I just need to visit it again. |
| nmessenger | grr, after fixes, it was 1 |
| sciolizer | nmessenger: Yeah, because x >>> x has 1 ">>>". |
| nmessenger | here we go: "let x = x >>> x :: AppCounter () () in count x" blows the stack sciolizer: actually, it's because arr starts at 1 and (arr x) has no (>>>)'s, so it doesn't increase. |
| sciolizer | nmessenger: You're right. But I still don't understand why. |
| nmessenger | > let x = x + x :: Int in x |