Avoiding specified imports during development

I was getting set to write a whole post about how traverse wasn’t working right, when I discovered that the underlying problem was that I had imported Data.Newtype but not Data.Traversable, so I was getting the wrong traverse.

This points to a larger problem. For the first couple of weeks of Purescript development, I was specifying all my imports and avoiding any warnings. However, it got to be a real hassle to keep updating my imports every time I made a small change to the code.

I’m learning Purescript and developing a program that is close to research, so things are changing all the time. I think I was spending almost as much time adjusting imports as I was coding!

So I thought I would just go back to unspecified imports. But that led to my problem today. If I had specified my imports I would quickly discovered a conflict between the two traverses.

Are they any solutions? Perhaps I could specify imports for modules I’m less familiar with, like Data.Newtype, and leave other imports unspecified.

Mike

Have you tried using the editor integration for handling your imports automatically? Importing things on completion in combination with applying the compiler suggestions for removing redundant imports handles all the import needs I have.

There are plugins for VSCode, Atom, Vim and Emacs.

1 Like

I’m using Emacs and noticed it sometimes adjusts the imports, but I didn’t notice that was on completion. I often use dynamic abbreviations rather than company-mode completion. Old habit from before company-mode even existed. Maybe I should change.

I was spending as much time removing imports as I was adding them. It’s a research program in flux.