A class for types with a distinguished aesthetically pleasing value
#1Book club
Some of the most interesting strings have been published in libraries around the world for many years now. I think we could consider an overlapping instance to let people have convenient access to these interesting values. Many books are even out of copyright now making it making their inclusion possible without changing the Acme.Default licensing.
instance {-# OVERLAPPING #-} Default String where
def = unsafePerformIO (readFile "moby_dick.txt")
I propose Moby Dick to get things started. It's available online under the Project Gutenberg license at https://www.gutenberg.org/files/2701/2701-h/2701-h.htm. Other choices from various literary canons from cultures around the world could be considered. A second proposal would be Journey to the West (西遊記) for its impact in the Chinese literary canon as well as its broad transcription into worldwide media.
Another option would be to use Data.FileEmbed
Well, unfortunately Haskell's semantics doesn't quite support that particular instance, as indicated by your usage of
unsafePerformIO
. However, what about a default action forIO String
?