Imagine such a function:

bar :: Foo -> A -> B -> C -> IO ()

That function performs some IO stuff using a Foo and other values. The Foo value has to be passed to bar , and can be retrieved from IO via this:

foo :: X -> IO Foo

Now, A , B , C and X are all plain pure values. I’d rather like such a bar function:

bar :: X -> A -> B -> C -> IO ()

And Foo would be generated in the bar function using the X value. If I do that :

let f = bar myX