title: Yesod-platform installation failing because of Alex package
body: <p>I'm trying to update the yesod platform to the latest version. In order to do this, I have executed the following commands:</p>
  
  <pre><code>cabal update
  cabal install yesod-platform yesod-bin
  </code></pre>
  
  <p>To which I eventually get the following error:</p>
  
  <pre><code>Resolving dependencies...
  Configuring language-javascript-0.5.13...
  cabal: The program alex version &gt;=3.0.5 is required but the version found at /usr/bin/alex is version 3.0.1
  cabal: Error: some packages failed to install:
  hjsmin-0.1.4.6 depends on language-javascript-0.5.13 which failed to install
  language-javascript-0.5.13 failed during the configure step. The exception was:
  ExitFailure 1
  yesod-platform-1.2.12.2 depends on language-javascript-0.5.13 which failed to install
  yesod-static-1.2.4 depends on language-javascript-0.5.13 which failed to install
  </code></pre>
  
  <p>After a bit of research, I have stumbled on the <a href="http://www.yesodweb.com/book/haskell" rel="nofollow">following post</a> which mentions I should install a few more dependencies manually before doing the <code>cabal install yesod-platform yesod-bin</code> command. Those dependencies include <code>alex</code> amongst others. This, unfortunately, did not help as I got the same errors when I tried again.</p>
  
  <p>I have then noticed that the version of <code>alex</code> in my <code>/usr/bin/alex</code> is still 3.0.1 after the manual install of <code>alex</code> version 3.0.5. After a bit of research, it seems when installing that package, it installs it in the <code>$HOME/.cabal/bin</code> and that path was not in my <code>$PATH</code> variable, so I added it in the <code>/etc/environment</code> file before the the entry <code>/usr/bin/</code>. After a reboot of my server, I have once again tried, but still get the same error.</p>
  
  <p>Even if I added <code>$HOME/.cabal/bin</code> before <code>/usr/bin/</code>, it still goes in the latter to look for <code>alex</code>, which seems to be the problem. Other than copying the executable of <code>alex</code> version 3.0.5 from <code>$HOME/.cabal/bin</code> to <code>/usr/bin/</code> manually (which I'm scared would cause me some problems, and headaches when wanting to update in the future), what could I do? Is this the real problem here?</p>
  
  <p>Also, as a side question, when I <code>echo $PATH</code>, the $HOME is not resolved to <code>/home/&lt;myusername&gt;</code> (I see <code>$HOME/...</code>), is this normal?</p>
  
  <p>EDIT: Tried renaming <code>alex</code> to <code>alex.bak</code> in <code>/usr/bin/</code> to try and "force" ubuntu to take the one from <code>$HOME/.cabal/bin</code>, but it now cannot find any program named <code>alex</code>. Why is it not finding it in <code>$HOME/.cabal/bin</code>?</p>