Is there a way to partially apply getLine
to writeFile
or a similar function (for file naming purposes)? I want to do something like this:
main = writeFile ??? . computeSomething =<< somethingElse
???
should be a line entered by the user to name the output file but I have no idea what to insert for ???
. I tried inserting =<< getLine
and similar snippets but nothing worked for me.
Is it possible to achieve this without using do-notation in a readable way?
You can use flip
to flip the order of arguments:
getLine >>= flip writeFile computeSomething
The tool pointfree
is helpful if you want to eta-reduce a function.