How to set ghc options while building Setup.hs in cabal package?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set ghc options while building Setup.hs in cabal package?

Magicloud Magiclouds
Hi,

I have some code in Setup.hs in a cabalized project. I'd like them to
be warning-free. But I could not find a way to set -Wall.

I tried ghc-options in ~/.cabal/config. But seems like it did not kick in.

```
/bin/ghc --make -fbuilding-cabal-package -odir
/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup
-hidir /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup
-i -i/home/shida/src/Personal/cairo-core/. -optP-include
-optP/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup_macros.h
-hide-all-packages -no-user-package-db -package-db
/home/shida/.cabal/store/ghc-8.6.3/package.db -package-db
/home/shida/src/Personal/cairo-core/dist-newstyle/packagedb/ghc-8.6.3
-package-id Cabal-2.4.0.1 -package-id base-4.12.0.0 -package-id
directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id
haskell-src-exts-1.21.0-f3e84a9ee8883b0dcaaaaba712d74996854b441aa843a4dedc055c685debcfdb
/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup.hs
-o /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup
-threaded
```
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: How to set ghc options while building Setup.hs in cabal package?

Daniel Díaz Casanueva
Hi.

I haven't tried myself, but perhaps the OPTIONS_GHC pragma will do what you want. Just add

{-# OPTIONS_GHC -Wall #-}

to the beginning of your Setup.hs file.


I hope that helps.

Best,
Daniel

Am Mi., 16. Jan. 2019, 09:54 hat Magicloud Magiclouds <[hidden email]> geschrieben:
Hi,

I have some code in Setup.hs in a cabalized project. I'd like them to
be warning-free. But I could not find a way to set -Wall.

I tried ghc-options in ~/.cabal/config. But seems like it did not kick in.

```
/bin/ghc --make -fbuilding-cabal-package -odir
/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup
-hidir /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup
-i -i/home/shida/src/Personal/cairo-core/. -optP-include
-optP/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup_macros.h
-hide-all-packages -no-user-package-db -package-db
/home/shida/.cabal/store/ghc-8.6.3/package.db -package-db
/home/shida/src/Personal/cairo-core/dist-newstyle/packagedb/ghc-8.6.3
-package-id Cabal-2.4.0.1 -package-id base-4.12.0.0 -package-id
directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id
haskell-src-exts-1.21.0-f3e84a9ee8883b0dcaaaaba712d74996854b441aa843a4dedc055c685debcfdb
/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup.hs
-o /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup
-threaded
```
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: How to set ghc options while building Setup.hs in cabal package?

Magicloud Magiclouds
Ah, thanks.

On Wed, Jan 16, 2019 at 5:55 PM Daniel Díaz Casanueva
<[hidden email]> wrote:

>
> Hi.
>
> I haven't tried myself, but perhaps the OPTIONS_GHC pragma will do what you want. Just add
>
> {-# OPTIONS_GHC -Wall #-}
>
> to the beginning of your Setup.hs file.
>
> More info: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using.html#source-file-options
>
> I hope that helps.
>
> Best,
> Daniel
>
> Am Mi., 16. Jan. 2019, 09:54 hat Magicloud Magiclouds <[hidden email]> geschrieben:
>>
>> Hi,
>>
>> I have some code in Setup.hs in a cabalized project. I'd like them to
>> be warning-free. But I could not find a way to set -Wall.
>>
>> I tried ghc-options in ~/.cabal/config. But seems like it did not kick in.
>>
>> ```
>> /bin/ghc --make -fbuilding-cabal-package -odir
>> /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup
>> -hidir /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup
>> -i -i/home/shida/src/Personal/cairo-core/. -optP-include
>> -optP/home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup_macros.h
>> -hide-all-packages -no-user-package-db -package-db
>> /home/shida/.cabal/store/ghc-8.6.3/package.db -package-db
>> /home/shida/src/Personal/cairo-core/dist-newstyle/packagedb/ghc-8.6.3
>> -package-id Cabal-2.4.0.1 -package-id base-4.12.0.0 -package-id
>> directory-1.3.3.0 -package-id filepath-1.4.2.1 -package-id
>> haskell-src-exts-1.21.0-f3e84a9ee8883b0dcaaaaba712d74996854b441aa843a4dedc055c685debcfdb
>> /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup.hs
>> -o /home/shida/src/Personal/cairo-core/dist-newstyle/build/x86_64-linux/ghc-8.6.3/cairo-core-1.16.0/setup/setup
>> -threaded
>> ```
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com.
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.



--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.