'use strict'
const electron = require('electron')
const React = require('react')
const ReactDOM = require('react-dom')
const $ = require('jquery')
const jQuery = require('jquery')
const app = electron.app // this is our app
const BrowserWindow = electron.BrowserWindow // This is a Module that creates windows

let mainWindow // saves a global reference to mainWindow so it doesn't get garbage collected

app.on('ready', createWindow) // called when electron has initialized

// This will create our app window, no surprise there
function createWindow () {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600
  })

  // display the index.html file
  mainWindow.loadURL(`file://${ __dirname }/index.html`)

  // open dev tools by default so we can see any console errors
  mainWindow.webContents.openDevTools()

  mainWindow.on('closed', function () {
    mainWindow = null
  })

  mainWindow.maximize();

}

/* Mac Specific things */

// when you close all the windows on a non-mac OS it quits the app
app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') { app.quit() }
})

// if there is no mainWindow it creates one (like when you click the dock icon)
app.on('activate', () => {
  if (mainWindow === null) { createWindow() }
})

@@ -302,16 +302,63 @@
  windows
+%0Avar spawn = require('child_process').execSync;
 %0A%0Alet ma
@@ -463,24 +463,28 @@
 ady', create
+Main
 Window) // c
@@ -524,194 +524,369 @@
 ed%0A%0A
-// This will create our app window, no surprise there%0Afunction createWindow () %7B%0A  mainWindow = new BrowserWindow(%7B%0A    width: 800,%0A    height: 600%0A  %7D)%0A%0A  // display the index.html file
+function createMainWindow () %7B%0A  if (!stackIsOnPath()) %7B%0A    electron.dialog.showErrorBox(%7B%0A      title:%22HaskellDO initialization error%22,%0A      content:%22Stack not found on path. Try adding it?%22%0A    %7D);%0A    app.exit(-1);%0A  %7D%0A  const %7Bwidth, height%7D = electron.screen.getPrimaryDisplay().workAreaSize%0A  mainWindow = new BrowserWindow(%7Bwidth, height, show: false%7D)
 %0A  m
@@ -943,207 +943,355 @@
 l%60)%0A
-%0A
   
-// open dev tools by default so we can see any console errors%0A  mainWindow.webContents.openDevTools()%0A%0A  mainWindow.on('closed', function () %7B%0A    mainWindow = null%0A  %7D)%0A%0A  mainWindow.maximize();%0A
+mainWindow.webContents.openDevTools()%0A%0A  mainWindow.once('ready-to-show', () =%3E %7B%0A    mainWindow.show()%0A  %7D)%0A%0A  mainWindow.on('closed', function () %7B%0A    mainWindow = null%0A  %7D)%0A%0A%7D%0Afunction stackIsOnPath () %7B%0A        try %7B%0A          var out = spawn('stack --help');%0A        %7D catch (error) %7B%0A          return false;%0A        %7D%0A        return true;
 %0A%7D%0A%0A

Add stack checking