[Haskell-cafe] Troubles understanding memoization in SOE
bf3 at telenet.be
bf3 at telenet.be
Wed Sep 26 08:45:14 EDT 2007
Gee you are right, how embarrasing. I mistakenly read the signature of ***
just above &&&, which is
(***) :: Arrow a ⇒ a b c → a b’ c’ → a (b,b’) (c,c’)
Now just to me sure I get it right, *** results in an arrow that has two
inputs (b,b') and two outputs (c,c')?
> (&&&) :: Arrow (~>) => (b ~> c) -> (b ~> c') -> (b ~> (c, c'))
Hey that’s a nice trick, and it is valid Haskell :)
Peter
-----Original Message-----
From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.
org] On Behalf Of Bertram Felgenhauer
Sent: Wednesday, September 26, 2007 2:06 PM
To: haskell-cafe at haskell.org
Subject: Re: [Haskell-cafe] Troubles understanding memoization in SOE
Peter Verswyvelen wrote:
> Paul L wrote:
> A minor detail in your paper: on page 7, you represent *(d) sf1 &&& sf2
*as
> a big box taking one input and producing two outputs. The input is
> internally split using a Y. This does not seem consistent with the other
> boxes (e.g. *first *or *loop *internally) that show two arrows for an
> incoming/outgoing pair, so I would say the outer box of &&& would also
have
> two inputs and two outputs.
But look at the type of &&&:
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
or, perhaps more readable,
(&&&) :: Arrow (~>) => (b ~> c) -> (b ~> c') -> (b ~> (c, c'))
As you can see, the resulting arrow of type (b ~> (c, c')) really has
only one input and produces a pair, i.e. two outputs. Internally it
must duplicate the b input somehow and apply it to both input arrows,
exactly as the box shows.
Bertram
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list