[Haskell-beginners] f . g or f g or f $ g?

Emanuel Koczwara poczta at emanuelkoczwara.pl
Fri Feb 1 21:04:13 CET 2013


Hi,

Dnia 2013-02-01, pią o godzinie 20:42 +0100, Martin Drautzburg pisze:
> Hello all
> 
> I frequently get confused over f . g vs f g. I do understand the following
> 
> With:
> 
> g :: a->b
> f :: b ->c
> 
> f.g :: a->c
> 
> However 
> 
> f g 
> 
> is a type error, because then f would have to accept a function (a->b) as its 
> first parameter, but it only accepts a b.
> 
> Is there a way to easily remember when to use f.g and when to use f g without 
> having to do this type algebra.
> 

  Maybe this could be a hint, consider this:

  f . g == (.) f g

Emanuel





More information about the Beginners mailing list