turtle icon indicating copy to clipboard operation
turtle copied to clipboard

Treat Line as Text (but not vice versa)

Open GregorySchwartz opened this issue 8 years ago • 2 comments

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 avatar Feb 10 '17 15:02 GregorySchwartz

@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)

Gabriella439 avatar Feb 20 '17 18:02 Gabriella439

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.

GregorySchwartz avatar Feb 20 '17 18:02 GregorySchwartz