[Haskell-beginners] The dot operator.

Antoine Latter aslatter at gmail.com
Sat Feb 18 20:44:22 CET 2012


On Sat, Feb 18, 2012 at 1:33 PM, bahadýr altan <doaltan at yahoo.co.uk> wrote:
> Hello. I saw the dot "." operator in some Haskell codes, but I couldn't
> figure out what it does. I didn't see it in some books and tutorials and
> couldn't find an explanation on the Internet. Could you tell me what it
> does?
>
> Thanks:)
>

Since it is an ordinary haskell function, it is something you can look
up with Hoogle:

http://www.haskell.org/hoogle/?hoogle=%28.%29

It is used for function composition - for example if you wrote a function:

> myFunc x = func1 (func2 x)

you can re-write this to:

> myFunc = func1 . func2

It's useful to cut down on parenthesis when you have a chain of
functions taking one argument.

Antoine



More information about the Beginners mailing list