[Haskell-beginners] Function Type Confusion ..

Brent Yorgey byorgey at seas.upenn.edu
Tue Jan 27 14:29:22 EST 2009


On Tue, Jan 27, 2009 at 10:47:40AM -0800, Tom Poliquin wrote:
> 
> On Tue, Jan 27, 2009 at 09:42:54AM -0800, Tom Poliquin wrote:
> > 
> > I was reading "Arrows and Computation" 
> > 
> > http://www.soi.city.ac.uk/~ross/papers/fop.ps.gz
> > 
> > (trying to lose my 'beginner' status) when I saw (on page
> > one) 
> > 
> > add :: (b -> Int) -> (b -> Int) -> (b -> Int)
> > add f g b = f b + g b
> > 
> > It seemed like the type definition was wrong (short at least).
> 
> > .....
> 
> > The trick is this:
> > add :: (b -> Int) -> (b -> Int) -> (b -> Int)
> > is equal to
> > add :: (b -> Int) -> (b -> Int) -> b -> Int
> 
> Wow! .. Thanks everyone for the fast and informative responses.
> 
> I get it now.
> 
> I'm an old time imperative (C, Java, etc) programmer and
> I find Haskell incredibly powerful ... and fun!
> 
> Now I can move on to  page two in "Arrows and Computation" ..
> 
> Thanks again .. 
> 
> Tom

Great!  Have fun.  I can guarantee you'll have more questions, so feel
free to ask more on this list, or for quick questions there's also the
#haskell IRC channel on freenode.net, which is another great place to
learn and ask questions.

-Brent


More information about the Beginners mailing list