mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 12:42:02 +03:00
ce44d3b50a
* Add trailing newline on non-empty list in unlines There are several reasons to do that: * a line in a text file is something which ends with newline, and the last line is not special * `unlines []` should be different from `unlines [""]` * `unlines (a ++ b) = unlines a ++ unlines b` * Haskell does it * Change lines function behaviour
10 lines
351 B
Idris
10 lines
351 B
Idris
import Data.String
|
|
|
|
main : IO ()
|
|
main = do printLn ("<" ++ (unlines []) ++ ">")
|
|
printLn ("<" ++ (unlines ["ab"]) ++ ">")
|
|
printLn ("<" ++ (unlines ["a", "b"]) ++ ">")
|
|
printLn ("<" ++ (fastUnlines []) ++ ">")
|
|
printLn ("<" ++ (fastUnlines ["ab"]) ++ ">")
|
|
printLn ("<" ++ (fastUnlines ["a", "b"]) ++ ">")
|