Never mind, I misread the code, 'zip' and the lazy definition of stream should add the necessary laziness.
-- ryan On Tue, Nov 1, 2011 at 3:36 PM, Ryan Ingram <[email protected]> wrote: > Try > > swap p = (snd p, fst p) > > or, equivalently > > swap ~(x,y) = (y,x) > > -- ryan > > > On Tue, Nov 1, 2011 at 1:30 PM, Captain Freako <[email protected]>wrote: > >> Hi John, >> >> I'm trying to use the GHCI debugger on this code: >> >> 20 instance ArrowLoop SF where >> 21 loop (SF f) = SF $ \as -> >> 22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs >> 23 where stream ~(x:xs) = x : stream xs >> 24 >> 25 swap :: (a,b) -> (b,a) >> 26 swap (x,y) = (y,x) >> >> in order to watch the recursion of the `loop' function unfold. >> However, when I single step through the code, I never stop on line 22 >> (where I could, presumably, peek in at `bs' and `cs', in order to see >> them develop): >> >> *SF> :break swap >> Breakpoint 1 activated at SF.hs:26:1-18 >> *SF> runSF (loop (arr swap)) [1,2,3] >> Stopped at SF.hs:26:1-18 >> _result :: (b, a) = _ >> [SF.hs:26:1-18] *SF> :step >> Stopped at SF.hs:26:14-18 >> _result :: (b, a) = _ >> x :: a = _ >> y :: b = _ >> [SF.hs:26:14-18] *SF> : >> [1Stopped at SF.hs:23:34-42 >> _result :: [a] = _ >> xs :: [a] = _ >> [SF.hs:23:34-42] *SF> : >> Stopped at SF.hs:23:13-42 >> _result :: [a] = _ >> [SF.hs:23:13-42] *SF> : >> Stopped at SF.hs:23:30-42 >> _result :: [a] = _ >> x :: a = _ >> xs :: [a] = _ >> [SF.hs:23:30-42] *SF> : >> (Pattern repeats.) >> >> Do you have any advice? >> >> Thanks, >> -db >> >> >> >> On Mon, Oct 31, 2011 at 3:19 PM, John Lask <[email protected]> wrote: >> > On 1/11/2011 1:35 AM, Captain Freako wrote: >> > >> > you need to study ArrowLoop and understand that. In the code >> >> _______________________________________________ >> Haskell-Cafe mailing list >> [email protected] >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
