title: Haskell: Can't import System.Random
body: <p>I have installed Haskell on MacOS Mojave via the instructions found <a href="https://www.haskell.org/platform/" rel="noreferrer">here</a>, i.e. using the <code>stack</code> command. However,</p>
  <pre><code>import System.Random
  </code></pre>
  <p>brought in <code>ghci</code> the error message <em>Could not find module ‘System.Random’</em>. By searching for a solution, I came accross this <a href="https://stackoverflow.com/questions/50939333/trying-to-install-system-random-on-stack">discussion on Stackoverflow</a>, and I followed the suggestion posted there by Michael Snoyman to try the command</p>
  <pre><code>stack install random
  </code></pre>
  <p>before entering ghci again. This command produced tons of output, one part relating to System.Random :</p>
  <blockquote>
  <p>random&gt; configure</p>
  <p>random&gt; Warning: random.cabal:15:2: Tabs used as indentation at 15:2, 16:2, 17:2</p>
  <p>random&gt; Configuring random-1.1...</p>
  <p>random&gt; build</p>
  <p>random&gt; Preprocessing library for random-1.1..</p>
  <p>random&gt; Building library for random-1.1..</p>
  <p>random&gt; [1 of 1] Compiling System.Random</p>
  <p>random&gt;</p>
  <p>random&gt; /private/var/folders/bg/zjbyc9fj64d5kr98_x5bfjtm0000gn/T/stack946/random-1.1/System/Random.hs:43:1: warning: [-Wtabs]</p>
  <p>random&gt;     Tab character found here, and in 74 further locations.</p>
  <p>random&gt;     Please use spaces instead.</p>
  <p>random&gt;    |</p>
  <p>random&gt; 43 |         (</p>
  <p>random&gt;    | ^^^^^^^^</p>
  </blockquote>
  <p>Now I some questions:</p>
  <p>(1) What exactly was I doing with this <em>stack install</em> command? I know that it is risky to run a command without knowing well what it is supposed to do, but truth is this is exactly what I did. My guess is that this is fetching some libraries (similarly to Gems in Ruby or CPAN in Perl) and add them to the Haskell implementation. But if these are &quot;official&quot; libraries, why then do I get a syntax error? Am I supposed to run <code>expand</code> on the sources which had been downloaded, to get rid of the tabs?</p>
  <p>(2) Is this really the official way to get System.Random into the installation, or is there a better way to get the Random module? I would have expected that this kind of module is already included in the distribution, like many other modules are.</p>
  <p>(3) What can I do now to get my Random numbers? Because I still get the error that the module can't be found (not surprisingly, if the source code of the random library has syntax errors)</p>