output always appends a newline
output "test" $ pure "foo"
gives a file with "foo\n" whereas
echo -n "foo" > test
gives a file with "foo", > doesn’t change the input.
This may be (was actually. :)) source of confusion. Of course it can be migitated by using Text.writeFile.
Yeah, this is intentional. The convention of the turtle library is that if you have a stream of Text, then each element represents lines, which is why when you write it out turtle adds newlines. I decided to sacrifice generality for convenience. If you want a (much) more general API then you may want to check out the pipes/pipes-group/pipes-text ecosystem which lets you group things along arbitrary chunk boundaries.
turtle does not even expose a way to write a line without a trailing newline anywhere in the API.
My recommendation is just to import an external function (like putStr or writeFile). Think of turtle more as a stepping stone to introduce beginners to the rest of the Haskell ecosystem rather than a comprehensive library.
Okay. I wasn’t aware of that. Maybe that is missing somewhere in the documentation?
Think of turtle more as a stepping stone to introduce beginners to the rest of the Haskell ecosystem rather than a comprehensive library.
As a regular Haskell user I still find it immensely useful.
Alright, I'll add something to that effect in either the main documentation or the tutorial (or both)