title: How to set current directory in GHCi?
body: <p>I am new to Haskell and using a Windows PC. I am trying to set up my GHCi interface so that I can write my code in my text editor before executing it using the GHCi.</p>
  
  <p>Currently, my GHCi reads </p>
  
  <pre><code>$ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help 
  Loading package ghc-prim ... linking ... done. 
  Loading package integer-gmp ... linking ... done. 
  Loading package base ... linking ... done.
  Prelude&gt;
  </code></pre>
  
  <p>According to this <a href="https://downloads.haskell.org/~ghc/7.8.1/docs/html/users_guide/loading-source-files.html" rel="noreferrer">site</a>, I have to save my Haskell files to the current directory or specify some other directory in order to access them. This is what I don't know how to do. </p>
  
  <p><strong>My Questions:</strong></p>
  
  <ol>
  <li>How do I set the current directory? </li>
  <li>How do I get the GHCi to tell me what the path for current directory is so I can check what it is set at when I want to? </li>
  </ol>
  
  <p>Please explain starting from the line </p>
  
  <pre><code>Prelude&gt;
  </code></pre>
  
  <p>as noted above so that I can follow along. </p>
  
  <p><strong>Note:</strong> </p>
  
  <p>The example Haskell code given was </p>
  
  <p>file name: Main.hs </p>
  
  <pre><code>main = print(fac(20))
  
  fac 0 = 1
  fac n = n * fac(n-1) 
  </code></pre>
  
  <p>and in the GHCi</p>
  
  <pre><code>prelude&gt; :load Main 
  Compiling Main ( Main.hs, interpreted ) 
  Ok, modules loaded: Main. 
  *Main&gt; fac 17 
  355687428096000
  </code></pre>
  
  <p>So I want to save Main.hs to a directory, specify this as the current directory in the GHCi, and then run the above code. </p>