diff --git a/ATS2-Postiats-include-0.3.8/ccomp/runtime/pats_ccomp_config.h b/ATS2-Postiats-include-0.3.8/ccomp/runtime/pats_ccomp_config.h
new file mode 100644
--- /dev/null
+++ b/ATS2-Postiats-include-0.3.8/ccomp/runtime/pats_ccomp_config.h
@@ -0,0 +1,49 @@
+/* ******************************************************************* */
+/*                                                                     */
+/*                         Applied Type System                         */
+/*                                                                     */
+/* ******************************************************************* */
+
+/*
+** ATS/Postiats - Unleashing the Potential of Types!
+** Copyright (C) 2011-20?? Hongwei Xi, ATS Trustful Software, Inc.
+** All rights reserved
+**
+** ATS is free software;  you can  redistribute it and/or modify it under
+** the terms of  the GNU GENERAL PUBLIC LICENSE (GPL) as published by the
+** Free Software Foundation; either version 3, or (at  your  option)  any
+** later version.
+** 
+** ATS is distributed in the hope that it will be useful, but WITHOUT ANY
+** WARRANTY; without  even  the  implied  warranty  of MERCHANTABILITY or
+** FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License
+** for more details.
+** 
+** You  should  have  received  a  copy of the GNU General Public License
+** along  with  ATS;  see the  file COPYING.  If not, please write to the
+** Free Software Foundation,  51 Franklin Street, Fifth Floor, Boston, MA
+** 02110-1301, USA.
+*/
+
+/* ****** ****** */
+
+/*
+(* Author: Hongwei Xi *)
+(* Authoremail: hwxi AT cs DOT bu DOT edu *)
+(* Start time: January, 2013 *)
+*/
+
+/* ****** ****** */
+
+#ifndef PATS_CCOMP_CONFIG_H
+#define PATS_CCOMP_CONFIG_H
+
+/* ****** ****** */
+
+// HX: it is yet empty
+
+/* ****** ****** */
+
+#endif /* PATS_CCOMP_CONFIG_H */
+
+/* end of [pats_ccomp_config.h] */
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -2,10 +2,8 @@
 
 [![Build Status](https://travis-ci.org/vmchale/fast-combinatorics.svg?branch=master)](https://travis-ci.org/vmchale/fast-combinatorics)
 
-This is a library for fast combinatorics using ATS. You may need to download the 
-relevant ATS libraries
-[here](http://www.ats-lang.org/Downloads.html#Install_of_ATS2_include) if
-linking fails.
+This is a library for fast combinatorics using ATS. As such, make sure
+a C compiler is installed. Build reports from Windows users are always welcome.
 
 Currently it is in-progress, being somewhat constrained by the fact that I have
 yet to figure out how to share arbitrary-precision types between ATS and Haskell.
@@ -14,7 +12,7 @@
 
 The Haskell library comes with the C bundled, however you may wish to build from
 source if you are hacking on the library. To that end, you can install
-[stack](http://haskellstack.org/), [patscc](http://www.ats-lang.org/Downloads.html) , and
+[stack](http://haskellstack.org/), [patscc](http://www.ats-lang.org/Downloads.html), and
 [pats-filter](https://github.com/Hibou57/PostiATS-Utilities) and build with
 
 ```bash
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,2 +1,36 @@
-import Distribution.Simple
-main = defaultMain
+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+
+
+#if __GLASGOW_HASKELL__ <= 784
+import           Control.Applicative
+#endif
+import qualified Codec.Archive.Tar                     as Tar
+import           Codec.Compression.GZip                (decompress)
+import           Distribution.Simple
+import           Distribution.Simple.Setup
+import           Distribution.Types.HookedBuildInfo
+import           Distribution.Types.PackageDescription
+import           Network.HTTP.Client                   hiding (decompress)
+import           Network.HTTP.Client.TLS               (tlsManagerSettings)
+import           System.Directory
+
+main = defaultMainWithHooks myHooks
+    where myHooks = simpleUserHooks { preBuild = buildScript
+                                    , postClean = cleanATS }
+
+cleanATS :: Args -> CleanFlags -> PackageDescription -> () -> IO ()
+cleanATS _ _ _ _ = removeDirectoryRecursive "ATS2-Postiats-include-0.3.8"
+
+buildScript :: Args -> BuildFlags -> IO HookedBuildInfo
+buildScript _ _ = do
+
+    putStrLn "Fetching libraries..."
+    manager <- newManager tlsManagerSettings
+    initialRequest <- parseRequest "https://downloads.sourceforge.net/project/ats2-lang/ats2-lang/ats2-postiats-0.3.8/ATS2-Postiats-include-0.3.8.tgz"
+    response <- responseBody <$> httpLbs (initialRequest { method = "GET" }) manager
+
+    putStrLn "Unpacking libraries..."
+    Tar.unpack "." . Tar.read . decompress $ response
+
+    pure emptyHookedBuildInfo
diff --git a/bench/Bench.hs b/bench/Bench.hs
--- a/bench/Bench.hs
+++ b/bench/Bench.hs
@@ -1,23 +1,23 @@
 module Main where
 
 import           Criterion.Main
-import           Numeric.Combinatorics
-import qualified Math.Combinatorics.Binomial as Ext
+import qualified Math.Combinatorics.Binomial  as Ext
 import qualified Math.Combinatorics.Factorial as Ext
+import           Numeric.Combinatorics
 
 hsIsPrime :: Int -> Bool
 hsIsPrime x = null [ y | y <- [2..m], x `mod` y == 0]
-    where m = floor (sqrt (fromIntegral x))
+    where m = floor (sqrt (fromIntegral x :: Float))
 
 main :: IO ()
 main =
     defaultMain [ bgroup "factorial"
                       [ bench "factorial" $ nf factorial 12
-                      , bench "Ext.factorial" $ nf factorial 12
+                      , bench "Ext.factorial" $ nf (Ext.factorial :: Int -> Int) 12
                       ]
                 , bgroup "choose"
                       [ bench "choose" $ nf (13 `choose`) 4
-                      , bench "Ext.choose" $ nf (13 `choose`) 4
+                      , bench "Ext.choose" $ nf (Ext.choose 13 :: Int -> Int) 4
                       ]
                 , bgroup "isPrime"
                       [ bench "isPrime" $ nf isPrime 2017
diff --git a/cbits/fast-combinatorics.c b/cbits/fast-combinatorics.c
--- a/cbits/fast-combinatorics.c
+++ b/cbits/fast-combinatorics.c
@@ -1,7 +1,7 @@
 /*
 **
 ** The C code is generated by [ATS/Postiats-0-3-8]
-** The starting compilation time is: 2017-12-30: 12h:55m
+** The starting compilation time is: 2017-12-30: 17h:55m
 **
 */
 
diff --git a/fast-combinatorics.cabal b/fast-combinatorics.cabal
--- a/fast-combinatorics.cabal
+++ b/fast-combinatorics.cabal
@@ -1,5 +1,5 @@
 name:                fast-combinatorics
-version:             0.1.0.2
+version:             0.1.0.3
 synopsis:            Fast combinatorics.
 description:         Fast combinatorics code with a high level of safety guaranteed by writing it in ATS.
 homepage:            https://github.com//fast-combinatorics#readme
@@ -9,10 +9,11 @@
 maintainer:          vamchale@gmail.com
 copyright:           Copyright: (c) 2017 Vanessa McHale
 category:            Numerics
-build-type:          Simple
+build-type:          Custom
 extra-source-files:  cbits/fast-combinatorics.c
+                   , ATS2-Postiats-include-0.3.8/ccomp/runtime/pats_ccomp_config.h
 extra-doc-files:     README.md
-cabal-version:       >=1.18
+cabal-version:       >= 1.18
 
 Flag development {
   Description: Enable `-Werror`
@@ -20,16 +21,29 @@
   default: False
 }
 
+custom-setup
+  setup-depends:   base
+                 , Cabal >= 2.0
+                 , http-client
+                 , http-client-tls
+                 , tar
+                 , zlib
+                 , directory
+
 library
   c-sources:           cbits/fast-combinatorics.c
+  include-dirs:        ATS2-Postiats-include-0.3.8/ccomp/runtime/
+                     , ATS2-Postiats-include-0.3.8/
   hs-source-dirs:      src
   exposed-modules:     Numeric.Combinatorics
-  build-depends:       base >= 4.7 && < 5
-                     , composition-prelude
+  build-depends:       base >= 4.6 && < 5
+                     , composition-prelude >= 0.1.1.3
   default-language:    Haskell2010
   if flag(development)
     ghc-options:       -Werror
-  ghc-options:         -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat -optc-mtune=native -optc-flto -optc-O3
+  if impl(ghc >= 8.0)
+    ghc-options:       -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat 
+  ghc-options:         -Wall -optc-mtune=native -optc-flto -optc-O3
 
 test-suite fast-combinatorics-test
   type:                exitcode-stdio-1.0
@@ -42,7 +56,9 @@
                      , arithmoi
   if flag(development)
     ghc-options: -Werror
-  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat
+  if impl(ghc >= 8.0)
+    ghc-options:       -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat 
+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -Wall
   default-language:    Haskell2010
 
 benchmark fast-combinatorics-bench
@@ -55,7 +71,9 @@
                      , combinatorics
   if flag(development)
     ghc-options: -Werror
-  ghc-options:         -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat -optc-mtune=native -optc-flto -optc-O3
+  if impl(ghc >= 8.0)
+    ghc-options:       -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat 
+  ghc-options:         -Wall -optc-mtune=native -optc-flto -optc-O3
   default-language:    Haskell2010
 
 source-repository head
diff --git a/src/Numeric/Combinatorics.hs b/src/Numeric/Combinatorics.hs
--- a/src/Numeric/Combinatorics.hs
+++ b/src/Numeric/Combinatorics.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP                      #-}
 {-# LANGUAGE ForeignFunctionInterface #-}
 
 module Numeric.Combinatorics
@@ -14,9 +15,17 @@
 foreign import ccall unsafe factorial_ats :: CInt -> CInt
 foreign import ccall unsafe choose_ats :: CInt -> CInt -> CInt
 foreign import ccall unsafe double_factorial :: CInt -> CInt
+#if __GLASGOW_HASKELL__ >= 820
 foreign import ccall unsafe is_prime_ats :: CInt -> CBool
+#else
+foreign import ccall unsafe is_prime_ats :: CInt -> CUChar
+#endif
 
+#if __GLASGOW_HASKELL__ >= 820
 convertBool :: CBool -> Bool
+#else
+convertBool :: CUChar -> Bool
+#endif
 convertBool = go . fromIntegral
     where
         go :: Word8 -> Bool
