The left and right operands (.)are equal
forM_ [stdout, stderr]
and
flip hPutStrLn
respectively.
Type hPutStrLn-
hPutStrLn :: Handle -> String -> IO ()
therefore flip hPutStrLnhas type
flip hPutStrLn :: String -> Handle -> IO ()
As the type system reports, it flipis a combinator that changes the order of other function arguments.
flip :: (a -> b -> c) -> b -> a -> c
flip f x y = f y x
ghci , (. flip hPutStrLn)
ghci> :type (. flip hPutStrLn)
(. flip hPutStrLn) :: ((Handle -> IO ()) -> c) -> String -> c
,
ghci> :type forM_ [stdout, stderr]
forM_ [stdout, stderr] :: Monad m => (Handle -> m b) -> m ()
, .
(. flip hPutStrLn) :: ((Handle -> IO ()) -> c ) -> String -> c
forM_ [stdout, stderr] :: Monad m => (Handle -> m b ) -> m ()
( )
ghci> :type forM_ [stdout, stderr] . flip hPutStrLn
forM_ [stdout, stderr] . flip hPutStrLn :: String -> IO ()
String, -, (), .. .
, , , (.). flip , .