Reverse the order of lines in a text file while preserving the contents of each line: Difference between revisions

Content added Content deleted
(→‎Pascal: move contents to →‎Free Pascal: and provide ISO-compliant source code, create →‎Delphi: referencing →‎Free Pascal)
(Initial Haskell version.)
Line 347: Line 347:
saying 'Nice Doggy'
saying 'Nice Doggy'
"Diplomacy is the art of
"Diplomacy is the art of
</pre>

=={{header|Haskell}}==
<lang haskell>import qualified Data.Text as T
import qualified Data.Text.IO as TIO

main :: IO ()
main = TIO.interact $ T.unlines . reverse . T.lines</lang>
{{out}}
<pre>
$ tac < tac.in
--- Will Rodgers

until you can find a rock."
saying 'Nice Doggy'
"Diplomacy is the art of
</pre>
</pre>