Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between IO a and IO (a) in Haskell?

What is the difference between IO (a) and IO a in Haskell?

For instance:

IO (String) vs IO String

IO (Int) vs IO Int

Most books I've seen wrap a type in parentheses before putting it after IO, but it's not obvious to me whether these are the same thing or not.

like image 734
James Strieter Avatar asked Nov 30 '25 03:11

James Strieter


1 Answers

There is no difference that would matter to the compiler.

Generally in Haskell, we like to avoid any unnecessary parentheses, so IO String is the preferred style. But of course you do need parens for e.g. IO (Maybe Int).

like image 192
leftaroundabout Avatar answered Dec 02 '25 16:12

leftaroundabout



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!