diff --git a/shake-ats.cabal b/shake-ats.cabal
--- a/shake-ats.cabal
+++ b/shake-ats.cabal
@@ -1,5 +1,5 @@
 name:                shake-ats
-version:             1.5.0.1
+version:             1.5.0.3
 synopsis:            Utilities for building ATS projects with shake
 description:         Various helper functions for building [ATS](http://www.ats-lang.org/) with the [shake](http://shakebuild.com/) library
 homepage:            https://github.com/vmchale/shake-ats#readme
diff --git a/src/Development/Shake/ATS.hs b/src/Development/Shake/ATS.hs
--- a/src/Development/Shake/ATS.hs
+++ b/src/Development/Shake/ATS.hs
@@ -66,7 +66,8 @@
 atsCommand tc sourceFile out = do
     path <- fromMaybe "" <$> getEnv "PATH"
     home' <- home tc
-    let env = patsEnv home' path
+    h <- fromMaybe "" <$> getEnv "HOME"
+    let env = patsEnv h home' path
     patsc <- patsopt tc
     command env patsc ["--output", out, "-dd", sourceFile, "-cc"]
 
@@ -85,8 +86,8 @@
         liftIO $ copyFile dep (home' ++ "/" ++ dep)
 
 -- This is the @$PATSHOMELOCS@ variable to be passed to the shell.
-patsHomeLocs :: Int -> String
-patsHomeLocs n = intercalate ":" $ (<> ".atspkg/contrib") . ("./" <>) <$> g
+patsHomeLocs :: FilePath -> Int -> String
+patsHomeLocs _ n = intercalate ":" $ (<> ".atspkg/contrib") . ("./" <>) <$> g
     where g = [ join $ replicate i "../" | i <- [0..n] ]
 
 makeCFlags :: [String] -- ^ Inputs
@@ -134,11 +135,11 @@
     h <- patsHome (compilerVer tc)
     pure $ h ++ "lib/ats2-postiats-" ++ show (libVersion tc)
 
-patsEnv :: FilePath -> FilePath -> [CmdOption]
-patsEnv home' path = EchoStderr False :
+patsEnv :: FilePath -> FilePath -> FilePath -> [CmdOption]
+patsEnv h home' path = EchoStderr False :
     zipWith AddEnv
         ["PATSHOME", "PATH", "PATSHOMELOCS"]
-        [home', home' ++ "/bin:" ++ path, patsHomeLocs 5]
+        [home', home' ++ "/bin:" ++ path, patsHomeLocs h 5]
 
 atsToC :: FilePath -> FilePath
 atsToC = (-<.> "c") . (".atspkg/c/" <>)
@@ -227,7 +228,8 @@
 trim :: String -> String
 trim = init . drop 1
 
-maybeError :: (MonadIO m) => Either (ATSError String) b -> m ()
+-- | Print any errors to standard error.
+maybeError :: (MonadIO m) => Either ATSError b -> m ()
 maybeError Right{}  = pure ()
 maybeError (Left y) = printErr y
 
diff --git a/src/Development/Shake/ATS/Generate.hs b/src/Development/Shake/ATS/Generate.hs
--- a/src/Development/Shake/ATS/Generate.hs
+++ b/src/Development/Shake/ATS/Generate.hs
@@ -5,11 +5,11 @@
 import           Data.Semigroup
 import           Language.ATS
 
-generateLinks :: String -> Either (ATSError String) String
+generateLinks :: String -> Either ATSError String
 generateLinks = fmap (printATS . generateLinks') . parse
 
-generateLinks' :: ATS -> ATS
-generateLinks' (ATS ds) = ATS (fmap g ds <> [macDecl])
+generateLinks' :: ATS a -> ATS a
+generateLinks' (ATS ds) = ATS (fmap g ds <> [macDecl]) --  ATS [Local undefined (ATS (fmap g ds <> [macDecl])) (ATS mempty)]
     where g f@Func{} = Extern undefined (set (fun.preF.expression) expr f)
           g x        = x
           expr = Just (StringLit "\"mac#\"")
