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

Initial Haskell version.
(→‎Pascal: move contents to →‎Free Pascal: and provide ISO-compliant source code, create →‎Delphi: referencing →‎Free Pascal)
(Initial Haskell version.)
Line 347:
saying 'Nice Doggy'
"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>
 
Anonymous user