[Haskell-cafe] cabal, Setup.lhs example

Edward Kmett ekmett at gmail.com
Fri Jul 23 08:07:42 EDT 2010


That actually runs contrary to one of cabal's other practices, which is to
add a 'simple' Setup.hs to your package as it makes the sdist is one is not
present. With your proposed change, it would then complain about _every_
package that used simple. ;)

Setup.hs exists so that you can execute runhaskell Setup.hs foo instead of
cabal foo. You just need to tell cabal if you want to delegate to Setup.hs,
by using something other than Simple as a build-type. The vast majority of
the users of cabal never bother changing the behavior of Setup.hs.

-Edward Kmett

On Thu, Jul 22, 2010 at 11:58 PM, Mark Wotton <mwotton at gmail.com> wrote:

> On Fri, Jul 23, 2010 at 12:33 PM, wren ng thornton <wren at freegeek.org>
> wrote:
> > Magnus Therning wrote:
> >>
> >> On Thu, Jul 22, 2010 at 11:52, Ross Paterson <ross at soi.city.ac.uk>
> wrote:
> >>>
> >>> On Thu, Jul 22, 2010 at 11:31:21AM +0100, Magnus Therning wrote:
> >>>>
> >>>> On Thu, Jul 22, 2010 at 10:59, Ross Paterson <ross at soi.city.ac.uk>
> >>>> wrote:
> >>>>>
> >>>>> Magnus is building by directly running the Setup.hs himself, which
> >>>>> ignores
> >>>>> the Build-Type.  To get cabal-install to use his Setup.hs, the
> >>>>> Build-Type
> >>>>> must be set to Custom.
> >>>>
> >>>> Oh, why*2?
> >>>>
> >>>> Why is the header there if it's not used by Cabal, and why does cabal
> >>>> care?
> >>>
> >>> The field allows cabal to avoid compiling the Setup.hs in this case.
> >>> It might also be used by other tools, e.g. one might only trust Simple
> >>> packages.  Not all fields are used by all tools, and several of them
> >>> do not affect the operation of the library (e.g. Home-page).
> >>
> >> All right, so why would cabal want to avoid compiling the Setup.hs?
> >>
> >> Of course this behaviour of cabal's means that I in the future will use
> >> *Custom*
> >> all the time, since I otherwise have to remember this surprising feature
> >> of a
> >> tool I never use.  Is there any reason *not* to do this?
> >
> > The main reason I could think of to avoid compiling it is for performance
> > reasons. I'm not sure how compelling that is, but...
> >
> > As for why not to always use Custom, as mentioned there are cabal-aware
> > tools out there besides cabal-install. For these other tools, there is a
> big
> > difference between Simple and Custom. With Simple we (ideally) already
> know
> > all the semantics of what Setup.hs does, and so we can wire that into our
> > tools. With Custom we're forced into the position of doing Haskell source
> > analysis since we now have to discover the semantics of an arbitrary
> Turing
> > machine. That's a very high wall to climb if you're just wanting to write
> a
> > simple tool for doing some kind of package analysis.
> >
> > (I don't think the behavior is surprising since I interpret Simple to
> mean
> > that the Setup.hs file is unused/optional. Though clearly YMMV)
>
>
> Ah, this clears up one of my bugs.
>
> Perhaps cabal should print a warning if you have a Setup.hs file,
> _and_ try to use Simple? It'd at least give the hint that they're
> unhappy together.
>
> mark
>
> --
> A UNIX signature isn't a return address, it's the ASCII equivalent of a
> black velvet clown painting. It's a rectangle of carets surrounding a
> quote from a literary giant of weeniedom like Heinlein or Dr. Who.
>         -- Chris Maeda
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100723/121c9a0a/attachment.html


More information about the Haskell-Cafe mailing list