
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:)

On Sat, Feb 18, 2012 at 1:33 PM, bahadýr altan
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

On 2/19/12, Antoine Latter
Since it is an ordinary haskell function, it is something you can look up with Hoogle:
More generally, you can use SymbolHound to look up anything regular search engines ignore, eg http://symbolhound.com/?q=haskell+%28.%29

It's function composition.
(.) :: (b -> c) -> (a -> b) -> (a -> c)
E.G. putStrLn . show $ 42
-R. Kyle Murphy
Sent from my phone.
On Feb 18, 2012 2:34 PM, "bahadýr altan"
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:)
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (4)
-
Antoine Latter
-
bahadýr altan
-
Kyle Murphy
-
Troy Pracy