[Haskell-beginners] point-free + IO Monad

Franco franco00 at gmx.com
Sun Mar 31 10:08:30 CEST 2013


Ovidiu D <ovidiudeac <at> gmail.com> writes:

> 
> I have the following code:
> 
> f1 :: String -> String
> 
> f2 :: IO String -> IO ()
> f2 a = do
>    b <- a
>    putStr $ f1 b
> 
> How can I write the function f2 in a point-free style?
> 

maybe 

f2 = (=<<) (putStrLn . f1)

I still prefer the non point-free but clearer

f2 = a >>= (putStrLn . f1)





More information about the Beginners mailing list