What is the best way to define native newline characters such as '\ n' or '\ r \ n' in Haskell?
I see that GHC.IO:Handle has a nativeNewline function, but suppose it is both a private API and most of all non-standard Haskell.
You should present the newline representation as part of the encoding of a text file that is stored in the file system as UTF-8. A text file is usually decoded when you read it in your program and encode while writing - conversion to and from your own newline representation is performed as part of this encoding and decoding. Inside your Haskell program, as well as the characters are represented by their Unicode code, the newline character always \n.
\n
To tell the I / O system about the encoding of the new line that you want to use, see the Newline Conversion section in the System documentation. IO.
System.IO.nativeNewline - , GHC " " .
System.IO.nativeNewline
, System.IO.Newline, Show GHC 6.12.3. , . , System.IO.LF System.IO.CRLF.
System.IO.Newline
Show
System.IO.LF
System.IO.CRLF
, , - GHC.
Unicode- -, Haskell. Haskell 2010. , GHC, , , , .