turtle
turtle copied to clipboard
Treat Line as Text (but not vice versa)
onLines :: (Text -> Text) -> Line -> Line
Like onFiles but for Line. Helps with editing lines without
stdout . join . fmap (select . textToLines . FUNCTION . lineToText) $ stdin
and instead would be
stdout . fmap (onLines FUNCTION) $ stdin
@GregorySchwartz The issue is that the Text -> Text function that you pass to onLines might return a Text with newlines (and therefore produce an invalid Line)
Ah, yes, that's true. I suppose a breaking way to solve that is to have Text.filter (not . isSpace) in the definition, but that would have to pass through the whole string.