title: Unexpected semi-colons in conditional
body: <p>I have the following line of code which when compiled with GHC it goes without a hitch:</p>
  
  <pre><code>addRDF c (Just (FILE))  = do
    (_:file:_) &lt;- getArgs
    check &lt;- doesFileExist file
    if check then do rdfG &lt;- TLI.readFile file &gt;&gt;= (return . parseN3fromText)
                     case rdfG of (Left s)  -&gt; putStrLn s
                                  (Right g) -&gt; storeRDF c g
    else do putStrLn "Specified files does not exist"
  </code></pre>
  
  <p>But when I run it through the cabal build process, it dumps out the following error.</p>
  
  <pre><code>Repository/Adder.hs:46:35:
      Unexpected semi-colons in conditional:
      if check then do { rdfG &lt;- TLI.readFile file
                               &gt;&gt;=
                                 (return . parseN3fromText);
                         case rdfG of {
                           (Left s) -&gt; putStrLn s
                           (Right g) -&gt; storeRDF c g } }; else do { putStrLn
                                                                      "Specified files does not exist" }
  Perhaps you meant to use -XDoAndIfThenElse?
  </code></pre>
  
  <p>I can see the additional semicolon in the error but I don't understand where that comes from.</p>
  
  <p>Here is my cabal configuration file:</p>
  
  <pre><code>cabal-version: &gt;= 1.2
  build-type: Simple
  
  library
    build-depends:
      base,
      containers,
      HTTP &gt;= 4000.2.2,
      directory &gt;= 1.1.0.0,
      text &gt;= 0.11.1.13,
      swish &gt;= 0.6.5.2
    exposed-modules: Repository.Adder, Repository.Configuration
    ghc-options: -Wall
  
  executable repository-add
    main-is: repository-add.hs
    build-depends:
      MissingH,
      swish &gt;= 0.6.5.2,
      split &gt;= 0.1.4.2
    ghc-options: -Wall
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>With correct indentation for <code>if</code>:</p>
  
  <pre><code>addRDF c (Just (FILE))  = do (_:file:_) &lt;- getArgs
    check &lt;- doesFileExist file
    if check
    then do rdfG &lt;- TLI.readFile file &gt;&gt;= (return . parseN3fromText)
            case rdfG of (Left s)  -&gt; putStrLn s
                         (Right g) -&gt; storeRDF c g
    else do putStrLn "Specified files does not exist"
  </code></pre>
  
  <p>I get a semicolon after <code>check</code> now as well:</p>
  
  <pre><code>Repository/Adder.hs:46:35:
      Unexpected semi-colons in conditional:
          if check; then do { rdfG &lt;- TLI.readFile file
                                    &gt;&gt;=
                                      (return . parseN3fromText);
                              case rdfG of {
                                (Left s) -&gt; putStrLn s
                                (Right g) -&gt; storeRDF c g } }; else do { putStrLn
                                                                           "Specified files does not exist" }
      Perhaps you meant to use -XDoAndIfThenElse?
  </code></pre>