Index: bin/MakeRecipe
===================================================================
--- bin/MakeRecipe	(revision 3176)
+++ bin/MakeRecipe	(working copy)
@@ -276,6 +276,12 @@
 then
    Log_Normal "$packagename $versionnumber build system seems to be based on CMake."
    echo "recipe_type=cmake" >> "$recipefile"
+elif egrep - q"Setup.l?hs" "$file_contents"
+then
+   # Note: check Haskell Cabal before regular configure because cabal
+   # will often invoke autoconf operations
+   Log_Normal "$packagename $versionnumber build system seems to be based on Haskell Cabal."
+   echo "recipe_type=cabal" >> "$recipefile"
 elif grep -q "configure.in$" "$file_contents" \
 || grep -q "configure.ac$" "$file_contents"
 then
Index: bin/Compile
===================================================================
--- bin/Compile	(revision 3176)
+++ bin/Compile	(working copy)
@@ -1429,5 +1429,52 @@
 
 ##################################################
 
+
+if [ "$recipe_type" = "cabal" ]
+then
+   Quiet ghc -V || Die "This is a cabal recipe and you don't seem to have GHC installed."
+   [ "$runhaskell" ] || runhaskell="runhaskell"
+   if [ ! "$override_default_options" = "yes" ]
+   then
+      cabal_variables=(
+         "${cabal_variables[@]}"
+         "--prefix=$target"
+      )
+   fi
+   for flag in "${useflags[@]}"
+   do
+      cabal_variables=("${cabal_variables[@]}" "`eval echo '$'with_$flag`")
+   done
+   if [ ! -z "$goboIndex" ]
+   then
+      cabal_variables=(`echo ${cabal_variables[@]} | sed "s,$target,$goboIndex,g"`)
+   fi
+   build_tree_if "true"
+   for f in Setup.lhs Setup.hs ; do
+      [ -e $f ] && cabal_setup="$f";
+   done
+   [ ! -z "$cabal_setup" ] || Die "Cabal Setup.hs or Setup.lhs not found"
+   if ! [ "$do_build" = "no" ]
+   then
+      $runhaskell "$cabal_setup" configure "${cabal_variables[@]}" || wrap_fail "Configure failed"
+      run_hooks pre_build
+      $runhaskell "$cabal_setup" build "${build_variables[@]}" || wrap_fail "Build failed."
+   fi
+   Boolean "no-install" && exit
+   run_hooks pre_install
+   if [ ! "$do_install" = "no" ]
+   then
+      pkg_dbloc=$(dirname `ghc-pkg list | head -n 1 | cut -f1 -d:`)
+      SandboxInstall $verbose ${sandboxopts[@]} -a $pkg_dbloc -c $runhaskell "$appname" "$versionnumber" -- "$cabal_setup" install "${install_variables[@]}" || wrap_fail "Installation failed."
+   fi
+   do_symlink --no-make "$appname" "$versionnumber" || wrap_fail "Installation failed."
+   check_direct_dependencies
+   run_hooks post_install
+   Log_Normal "Package registered via ghc-pkg; manual update required on package changes (InstallPackage, RemoveProgram, etc.)"
+   wrapup
+fi
+
+##################################################
+
 Die "Unsupported configuration in recipe '$recipe'."
 
Index: bin/RecipeLint
===================================================================
--- bin/RecipeLint	(revision 3176)
+++ bin/RecipeLint	(working copy)
@@ -540,6 +540,10 @@
        fi
    }
    fi
+   case "$recipe_type" in
+     (configure | makefile | python | perl | xmkmf | meta | scons | manifest | cabal)
+       false;;
+   esac && ERROR "Unknown Recipe type $recipe_type specified"
    [ "$recipe_type" = "meta" ] && {
       for inc in "${include[@]}"
       do
@@ -605,24 +609,26 @@
       configure_options=configure
       autogen_before_configure=configure
       autogen=configure
-      build_variables=configure,makefile,scons
-      install_variables=configure,makefile,xmkmf,scons
+      build_variables=configure,makefile,scons,cabal
+      install_variables=configure,makefile,xmkmf,scons,cabal
       make_variables=configure,makefile
       configure=configure
       makefile=configure,makefile,xmkmf
       build_target=configure,makefile,xmkmf,python,scons
       install_target=configure,makefile,xmkmf,python,scons
-      do_build=configure,makefile,python
-      do_install=configure,makefile,xmkmf,python,scons
+      do_build=configure,makefile,python,cabal
+      do_install=configure,makefile,xmkmf,python,scons,cabal
       needs_build_directory=configure
       manifest=manifest
       without=perl
       create_dirs_first=configure,makefile,perl
       python_options=python
-      override_default_options=python,scons,configure
+      override_default_options=python,scons,configure,cabal
       build_script=python
       scons=scons
       scons_variables=scons
+      cabal_variables=cabal
+      runhaskell=cabal
    )
    for decl in "${declarations[@]}"
    do
