As mentioned by others, IO - is a type constructor, not the type. Therefore, you should apply it to another type. Type value IO Foo means that this calculation, which potentially makes some input-output operations, and then returns a value of type Foo .
luqui larsman and suggested the use of () as the return value. I think the next type - the best alternative for a function that loops forever:
loop :: String -> IO a
Note that now the function is polymorphic in the return value. This type is much more informative than the return () . What for? Because the function of this type should be a function of cycling. It is impossible to implement complete function with this type. The user of this function will immediately see that this cycle function. Thus, you get the documentation for free with this type.
source share