Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. cabal multi-library setup (Cristian Petrescu Prahova) 2. Re: cabal multi-library setup (Magnus Therning) 3. GHC compilation without using module Main (Andrew Pennebaker) 4. Re: GHC compilation without using module Main (Daniel Fischer) 5. Re: GHC compilation without using module Main (Andrew Pennebaker) 6. Re: GHC compilation without using module Main (Andrew Pennebaker) 7. Re: GHC compilation without using module Main (Daniel Fischer) ---------------------------------------------------------------------- Message: 1 Date: Sun, 6 Mar 2011 12:30:45 -0800 From: Cristian Petrescu Prahova <crist...@gmail.com> Subject: [Haskell-beginners] cabal multi-library setup To: beginners@haskell.org Message-ID: <0a503181-4a24-4dce-b848-29d749b28...@gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Hi, I have a small project consisting of a library and an application. I cabalized both. However, whenever I tweak the library I cabal install it, then move to the app directory, then reconfigure, then rebuild. This is annoying repetitive shell typing. Is there a way to configure my setup such that cabal build app automatically rebuilds (and reinstalls?) the library dependency? I'd like something like: # builds the library and runs the tests cabal make lib # builds the app and the library dependency, then runs the app cabal make app Thank you, Cristian ------------------------------ Message: 2 Date: Sun, 6 Mar 2011 20:34:35 +0000 From: Magnus Therning <mag...@therning.org> Subject: Re: [Haskell-beginners] cabal multi-library setup To: beginners@haskell.org Message-ID: <20110306203435.GA7697@ohann> Content-Type: text/plain; charset="us-ascii" On Sun, Mar 06, 2011 at 12:30:45PM -0800, Cristian Petrescu Prahova wrote: > Hi, > > I have a small project consisting of a library and an application. I > cabalized both. However, whenever I tweak the library I cabal > install it, then move to the app directory, then reconfigure, then > rebuild. This is annoying repetitive shell typing. Is there a way to > configure my setup such that cabal build app automatically rebuilds > (and reinstalls?) the library dependency? I'd like something like: > > # builds the library and runs the tests > cabal make lib > > # builds the app and the library dependency, then runs the app > cabal make app I suspect you'll have to write a wrapper makefile in order to get something like that. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://www.haskell.org/pipermail/beginners/attachments/20110306/165e0f05/attachment-0001.pgp> ------------------------------ Message: 3 Date: Sun, 6 Mar 2011 17:32:43 -0500 From: Andrew Pennebaker <andrew.penneba...@gmail.com> Subject: [Haskell-beginners] GHC compilation without using module Main To: Haskell Beginners <beginners@haskell.org> Message-ID: <AANLkTi=1u94fpw80hcynqnk-mgj7poq8hqu5+oyko...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Is there a way to compile a Haskell script with a different module name than Main? #!/usr/bin/env runhaskell module ScriptedMain where meaningOfLife :: Int meaningOfLife = 42 main :: IO () main = putStrLn $ "Main: The meaning of life is " ++ show meaningOfLife $ ghc -o scriptedmain scriptedmain.hs Undefined symbols: "_ZCMain_main_closure", referenced from: _ZCMain_main_closure$non_lazy_ptr in libHSrtsmain.a(Main.o) (maybe you meant: _ZCMain_main_closure$non_lazy_ptr) "___stginit_ZCMain", referenced from: ___stginit_ZCMain$non_lazy_ptr in libHSrtsmain.a(Main.o) (maybe you meant: ___stginit_ZCMain$non_lazy_ptr) ld: symbol(s) not found collect2: ld returned 1 exit status Cheers, Andrew Pennebaker www.yellosoft.us -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110306/acdcc37a/attachment-0001.htm> ------------------------------ Message: 4 Date: Sun, 6 Mar 2011 23:54:53 +0100 From: Daniel Fischer <daniel.is.fisc...@googlemail.com> Subject: Re: [Haskell-beginners] GHC compilation without using module Main To: beginners@haskell.org Cc: Andrew Pennebaker <andrew.penneba...@gmail.com> Message-ID: <201103062354.53626.daniel.is.fisc...@googlemail.com> Content-Type: Text/Plain; charset="utf-8" On Sunday 06 March 2011 23:32:43, Andrew Pennebaker wrote: > Is there a way to compile a Haskell script with a different module name > than Main? > $ ghc -main-is ScriptedMain --make ScriptedMain The -main-is flag tells GHC what to regard as Main.main. Give it a module name (Foo) to say main is Foo.main, a function name (bar) to tell it main is Main.bar or a quailfied function name (Foo.bar) to tell it main is function bar in module Foo. ------------------------------ Message: 5 Date: Sun, 6 Mar 2011 18:03:26 -0500 From: Andrew Pennebaker <andrew.penneba...@gmail.com> Subject: Re: [Haskell-beginners] GHC compilation without using module Main To: Daniel Fischer <daniel.is.fisc...@googlemail.com> Cc: beginners@haskell.org Message-ID: <AANLkTini4HPgdTC4m2vmw=_ged1e9_vkycnskd6zr...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" I got -main-is to work with a single Haskell file, but it seems to have trouble with multiple files. $ cat scriptedmain.hs #!/usr/bin/env runhaskell module ScriptedMain where meaningOfLife :: Int meaningOfLife = 42 main :: IO () main = putStrLn $ "Main: The meaning of life is " ++ show meaningOfLife $ cat test.hs #!/usr/bin/env runhaskell module Test where import ScriptedMain hiding (main) main :: IO () main = putStrLn $ "Test: The meaning of life is " ++ show meaningOfLife $ ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs $ ./scriptedmain Main: The meaning of life is 42 $ ghc -o test -main-is Test.main test.hs scriptedmain.hs compilation IS NOT required ld: duplicate symbol _ZCMain_main_info in scriptedmain.o and test.o collect2: ld returned 1 exit status Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Mar 6, 2011 at 5:54 PM, Daniel Fischer < daniel.is.fisc...@googlemail.com> wrote: > On Sunday 06 March 2011 23:32:43, Andrew Pennebaker wrote: > > Is there a way to compile a Haskell script with a different module name > > than Main? > > > > $ ghc -main-is ScriptedMain --make ScriptedMain > > The -main-is flag tells GHC what to regard as Main.main. > Give it a module name (Foo) to say main is Foo.main, a function name (bar) > to tell it main is Main.bar or a quailfied function name (Foo.bar) to tell > it main is function bar in module Foo. > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110306/504cfced/attachment-0001.htm> ------------------------------ Message: 6 Date: Sun, 6 Mar 2011 18:21:35 -0500 From: Andrew Pennebaker <andrew.penneba...@gmail.com> Subject: Re: [Haskell-beginners] GHC compilation without using module Main To: Daniel Fischer <daniel.is.fisc...@googlemail.com> Cc: beginners@haskell.org Message-ID: <AANLkTi=zu9tmjiohyoazksaxlvx09e0qy4__ftc8p...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" It turns out you need to delete scriptedmain.o in order for test.hs to compile. Cheers, Andrew Pennebaker www.yellosoft.us On Sun, Mar 6, 2011 at 5:54 PM, Daniel Fischer < daniel.is.fisc...@googlemail.com> wrote: > On Sunday 06 March 2011 23:32:43, Andrew Pennebaker wrote: > > Is there a way to compile a Haskell script with a different module name > > than Main? > > > > $ ghc -main-is ScriptedMain --make ScriptedMain > > The -main-is flag tells GHC what to regard as Main.main. > Give it a module name (Foo) to say main is Foo.main, a function name (bar) > to tell it main is Main.bar or a quailfied function name (Foo.bar) to tell > it main is function bar in module Foo. > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110306/3a8496a4/attachment-0001.htm> ------------------------------ Message: 7 Date: Mon, 7 Mar 2011 00:26:51 +0100 From: Daniel Fischer <daniel.is.fisc...@googlemail.com> Subject: Re: [Haskell-beginners] GHC compilation without using module Main To: Andrew Pennebaker <andrew.penneba...@gmail.com> Cc: beginners@haskell.org Message-ID: <201103070026.52091.daniel.is.fisc...@googlemail.com> Content-Type: Text/Plain; charset="utf-8" On Monday 07 March 2011 00:03:26, Andrew Pennebaker wrote: > $ ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs > $ ./scriptedmain > Main: The meaning of life is 42 > $ ghc -o test -main-is Test.main test.hs scriptedmain.hs > compilation IS NOT required You have to recompile, I'm afraid. GHC generated the code for ScriptedMain.main as entry point 'main', then it generated the code for Test.main as entry point 'main', so there's two symbols for the entry point 'main', I don't think you can hide that from the linker. $ ghc -fforce-recomp -o test -main-is... That would of course be inconvenient if there's more than a small module to recompile, so it's a good idea to separate the 'main's from the code that really does stuff. > ld: duplicate symbol _ZCMain_main_info in scriptedmain.o and test.o > collect2: ld returned 1 exit status > > Cheers, > > Andrew Pennebaker ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 33, Issue 8 ****************************************