Why does this compile well:
import Network.HTTP.Conduit (simpleHttp)
import qualified Data.ByteString.Lazy.Char8 as L
main = L.putStrLn . L.take 500 =<< simpleHttp "http://stackoverflow.com/"
but this doesn't:
main = L.putStrLn $ L.take 500 =<< simpleHttp "http://stackoverflow.com/"
For me these are exactly the same. The errors in the 2nd case are:
Couldn't match type `L.ByteString' with `m0 b0'
Expected type: L.ByteString -> m0 b0
Actual type: L.ByteString -> L.ByteString
In the return type of a call of `L.take'
In the first argument of `(=<<)', namely `L.take 500'
In the second argument of `($)', namely
`L.take 500 =<< simpleHttp "http://stackoverflow.com/"'
Couldn't match expected type `L.ByteString'
with actual type `m0 b0'
In the second argument of `($)', namely
`L.take 500 =<< simpleHttp "http://stackoverflow.com/"'