Issue
I'm just starting to work through Real World Haskell, and have just gotten to the first example program. I'm running GHC on a Raspberry Pi, raspbian lite. The program, WC.hs, is
main = interact wordCount
where wordCount input = show (length (lines input)) ++ "\n"
and you call a csv text file that looks like
Paris, France
Ulm, Germany
Auxerre, France
Brunswick, Germany
When I try to run this program as proscribed in the book,
runghc WC < quux.txt
I get the error
target ‘prog’ is not a module name or a source file
What am I doing wrong here?
Solution
It seems that my installation of GHC was imperfect. Due to the RPi's ARM architecture, and some odd decisions they've made to keep Raspbian backwards-compatible, you currently have to make workarounds to install GHC. The first I tried was from this post, which worked well in GHCI, but didn't do well outside of it.
Luckily, since then, people more closely involved with GHC's development have taken an interest in making it ARM and RPi compatible, and created a healthier installation process (though still not fully package managed) here. After reinstalling GHC, the program worked.
Answered By - fiddling_junky