Yes, the more experience you get, the more you learn what error messages mean. Here’s an example:
I am learning to translate as “add containers to build-depends” by reading MULTIPLE PARAGRAPH ERROR MESSAGES OF MINIMAL USEFULNESS (<- yes, that’s me shouting.)
C:\Users\Michael Turner\aug\app\LockerState.hs:5:1: error:
Could not load module ‘Data.Map’
It is a member of the hidden package ‘containers-0.6.0.1’.
You can run ‘:set -package containers’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
|
5 | import qualified Data.Map as Map
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, six modules loaded.
: error:
Could not find module ‘LockerState’
It is not a module in the current program, or in any known package.
As a newbie, sometimes, when I’m a little tired I go back over “Learn You …” and just type in code and run it, to solidify concepts that I didn’t solidify on a first reading. And I run into snags. This one got unsnagged after way too much time, but finally arriving at this:
Which isn’t really about my problem, but I figured, What the hell, give part of the suggested solution a try. (With some trepidation, because I feared I’d end up having to add a version number, but I didn’t, thank God.)
The error message says there’s no such module, but in fact there is – it just didn’t compile for lack of ability to resolve Map. GHC has already seen the module declaration, so this report of “does not exist” is only true in some weird mathematical sense: the module was not well-formed, therefore it is not an element of the set of modules that ghci can see.
I didn’t want to have to do “:set -package containers” every time I got into ghci. Of course, I tried “stack ghci -package containers” but I knew it wouldn’t work, because there’s some trick (which I forgot, and didn’t want to google for again) for passing flags to ghci on the stack command line.
After getting things to work in the ostensibly seamless way you’d think they should, from just following along in the newbie tutorial “Learn You …”, I fumed for a while. Was there any real reason why we can’t just use build tools from The Rest of the World? What problems unique to Haskell do stack and cabal actually solve? Why, as a newbie, must I be slowed down in learning this language by these build tools with no obvious value-added over other build tools, and the error messages stemming from them, error messages that tell you how to work around the problem, but not how to actually solve it in a more satisfactory way?
Now let me really rant:
Somewhere else on this thread, someone remarks that you can’t really learn Haskell without a mentor or two. Now, think about this. I don’t know if that’s what anyone had in mind with “avoid success at all costs”. Still, perhaps it’s an unconscious emergent property caused by that impish nostrum being taken a little too seriously. For a programming language, a virtual requirement of mentorship is ANTI-viral. Infectious diseases that require multiple, persistent sources of infection have an R0 that’s effectively negative. They’ll never become endemic, much less epidemic. And when I’m fuming over some Kafkaesque obstacle (hmm, “cabal”, hey, that’s kinda paranoid for a name, isn’t it, come to think of it?) isn’t sort of like my mental immune system is trying to reject an infection – and almost succeeding?
OK, back to it.