-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework IsString instance to avoid pitfalls
* In ghci IsString.fromString = packCharsSafe. This is a partial function, throwing erros on characters out of Latin1 range, but partiality is not a big deal for interactive sessions. * For compiled programs: * For ASCII literals IsString.fromString = packChars = unsafePackLiteral, no runtime overhead and Core remains exactly the same as before. * For Unicode literals (and literals with '\0') IsString.fromString = packCharsSafe. This incurs runtime overhead, but such thunk is evaluated only once in its life. * For dynamic strings such as user input IsString.fromString = error. This is to make runtime behaviour more robust (if it crashes, it crashes for any input) and avoids a danger of routines, which were tested only for ASCII inputs but suddenly receive Unicode and silently lose data.
- Loading branch information
Showing
5 changed files
with
70 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters