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:             0.2.0.0
+version:             0.2.0.1
 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
@@ -29,16 +29,17 @@
 import           System.Exit                (ExitCode (ExitSuccess))
 
 newtype Version = Version [Integer]
+    deriving (Eq)
 
 instance Show Version where
-    show (Version [])     = ""
-    show (Version [x])    = show x
-    show (Version (x:xs)) = show x ++ "." ++ show (Version xs)
+    show (Version is) = intercalate "." (show <$> is)
 
+-- | The directory @~/.atspkg@
 pkgHome :: Action String
 pkgHome = fromMaybe "/usr/local/" <$> mh
     where mh = fmap (++ "/.atspkg/") <$> getEnv "HOME"
 
+-- | The directory that will be @PATSHOME@.
 patsHome :: Version -> Action String
 patsHome v = fmap (++ (show v ++ "/")) pkgHome
 
@@ -64,12 +65,10 @@
         liftIO $ createDirectoryIfMissing True (home ++ "/" ++ takeDirectory dep)
         liftIO $ copyFile dep (home ++ "/" ++ dep)
 
-
 patsHomeLocs :: Int -> String
 patsHomeLocs n = intercalate ":" $ (<> ".atspkg/contrib") . ("./" <>) <$> g
     where g = [ join $ replicate i "../" | i <- [1..n] ]
 
--- TODO musl?
 atsBin :: String -- ^ C compiler we should use
        -> [String] -- ^ Flags to pass to the C compiler
        -> Version -- ^ Library version
@@ -123,12 +122,12 @@
 -- @ats-src@ directory.
 cgen :: Version -- ^ Library version
      -> Version -- ^ Compiler version
-     -> FilePath -- ^ Directory for the generated C code
+     -> FilePath -- ^ Directory containing ATS source code
      -> Rules ()
 cgen v v' dir =
 
     "//*.c" %> \out -> do
-        let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")
+        let sourceFile = dir ++ "/" ++ (takeBaseName out -<.> "dats")
         handleSource v v' sourceFile
         atsCommand v v' sourceFile out
 
@@ -161,7 +160,7 @@
 
     "//*.c" %> \out -> do
 
-        let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")
+        let sourceFile = dir ++ "/" ++ (takeBaseName out -<.> "dats")
         handleSource v v' sourceFile
         (Exit c, Stderr err) :: (Exit, Stderr String) <- atsCommand v v' sourceFile out
         cmd_ [Stdin err] Shell "pats-filter"
