Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Cabal have a default target?

Tags:

haskell

cabal

If my .cabal file has multiple executables, I can single out one to build by typing the name

cabal build myExecutable

But I am lazy, and want to type just

cabal build

for a default target (I can stand the extra characters of typing for my secondary executables).

Is this possible? (I've been google'ing and looking through the cabal manual for a while now.... No definitive answer yet).

I have to do this, like, 1000 times a day....

like image 849
jamshidh Avatar asked Oct 19 '22 20:10

jamshidh


2 Answers

You could hack something together with flags, e.g.:

    flag all
      default: False

   executable first-prog:
     buildable: True

   executable second-prog
     if flag(all)
       buildable: True
     else
       buildable: False

   executable third-prog:
     if flag(all)
       buildable: True
     else
       buildable: False

and then use cabal configure -fall; cabal build when you wanted to build everything.

like image 188
ErikR Avatar answered Oct 30 '22 20:10

ErikR


You could use the age old solution of writing a make file and just type

$ make

into your terminal.

like image 20
Vasantha Ganesh Avatar answered Oct 30 '22 19:10

Vasantha Ganesh