readFile package:protolude

The readFile function reads a file and returns the contents of the file as a string. The entire file is read strictly, as with getContents. Beware that this function (similarly to readFile) is locale-dependent. Unexpected system locale may cause your application to read corrupted data or throw runtime exceptions about "invalid argument (invalid byte sequence)" or "invalid argument (invalid character)". This is also slow, because GHC first converts an entire input to UTF-32, which is afterwards converted to UTF-8. If your data is UTF-8, using decodeUtf8 . readFile is a much faster and safer alternative.