James Strieter
James Strieter

Reputation: 819

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.

Upvotes: 2

Views: 121

Answers (1)

leftaroundabout
leftaroundabout

Reputation: 120711

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

Upvotes: 8

Related Questions