I understand from the sample notebook that I should be able to enable and disable extensions as follows:
-- We can disable extensions.
:ext NoEmptyDataDecls
data Thing
<interactive>:1:1: error:
• ‘Thing’ has no constructors (EmptyDataDecls permits this)
• In the data declaration for ‘Thing’
-- And enable extensions.
:ext EmptyDataDecls
data Thing
However, when I try this with OverloadedStrings, I do not see any success. You can see from the below that T.lines is looking for String rather than Text. Why?
What am I misunderstanding or doing wrong?
Good news: the notebook above does have OverloadedStrings loaded correctly. The problem is you need to read the file with:
So
This was confusing because the error highlighted
T.lines
rather thanreadFile.
It turns outreadFile
does not produce a form of textual data that will automatically cast to the format required byT.lines
(it producesString
, notText
). You had to know that there is an entirely other function to call that does do that. The type system will not convert between these string-like formats for you. You must do this yourself by calling a file-reading function that explicitly returns aText
: here,T.readFile
.