[Haskell-cafe] cabal, Setup.lhs example

Magnus Therning magnus at therning.org
Thu Jul 22 04:42:14 EDT 2010


On Wed, Jul 21, 2010 at 17:43, Rogan Creswick <creswick at gmail.com> wrote:
> On Wed, Jul 21, 2010 at 3:00 AM, Magnus Therning <magnus at therning.org> wrote:
>>
>> I am successfully using hooks with the following in my .cabal file:
>>
>>    Build-Type    : Simple
>>
>> and my main in Setup.hs looks like this:
>>
>>    main = defaultMainWithHooks $ simpleUserHooks
>>        { cleanHook = profileClean
>>        , runTests = runTestsBuild
>>        }
>
> I've been unable to reproduce this -- flipping the build type to Custom has
> been necessary in every configuration I've tried.  I'd like to see what I'm
> doing differently -- is this used in a publicly available package I could
> take a look at?

It's not ready to be made public yet, but I put together the following
example:

  % cat test.cabal
  Name          : test
  Version       : 0.0.0
  License       : GPL
  Author        : Magnus Therning
  Maintainer    : magnus at therning.org
  Copyright     : Magnus Therning, 2009
  Build-Type    : Simple
  Cabal-Version : >= 1.2

  Executable test
      Main-Is        : Main.hs
      Build-Depends  : base >= 4.2.0 && < 4.3
  % cat Setup.hs
  #! /usr/bin/env runhaskell

  import Distribution.Simple

  main = defaultMainWithHooks $ simpleUserHooks
      { cleanHook = profileClean
      }

  profileClean pd v uh cf = do
      (cleanHook simpleUserHooks) pd v uh cf
      putStrLn "** in hook"
  % ./Setup.hs configure
  Configuring test-0.0.0...
  % ./Setup.hs clean
  cleaning...
  ** in hook

Could it be a difference in versions?

  % ghc --version
  The Glorious Glasgow Haskell Compilation System, version 6.12.1
  % ghc-pkg list | grep Cabal
      Cabal-1.8.0.2

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the Haskell-Cafe mailing list