3 ms·
How about print :: a->a or some variant. Or print:: a->(a->b)->a where (a->b) is a function that extracts some value 'b' out of 'a' and that value 'b'
by crimsonalucard 8y ago
How about
print :: a->a
or some variant.
Or
print:: a->(a->b)->a
where (a->b) is a function that extracts some value 'b' out of 'a' and that value 'b' is printed.
I mean pretty straightforward. id functions in your compositions don't effect the overall program.
This is only for the O part of IO. Input is a different problem.
- rocqua 8y agoThese are pretty close to the debug statements in haskell. This is partially problematic because of lazy evaluation. It is not clear when the print-statement will actually print. This could even lead to a re-ordering of the print statements. Another issue occurs when output is piped to input. In bash you could do something weird like: foo -i bar.txt >> bar.txt where -i is an input argument. I have to admit that I can't come up with a reason to run the above command. Really, maybe just ignore this part and consider the ordering issue.