Modulinos: Difference between revisions

Simplified compilation process
(Simplified compilation process)
Line 229:
Haskell has scripted main, but getting scripted main to work with compiled scripts is tricky.
 
<lang sh>$ rmrunhaskell scriptedmain.hihs
Main: The meaning of life is 42
$ ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs
$ runhaskell test.hs
Test: The meaning of life is 42
$ ghc -fforce-recomp -o scriptedmain -main-is ScriptedMain scriptedmain.hs
$ ./scriptedmain
Main: The meaning of life is 42
$ rmghc -fforce-recomp -o test -main-is Test test.hs scriptedmain.ohs
$ ghc -o test -main-is Test test.hs scriptedmain.hs
$ ./test
Test: The meaning of life is 42</lang>
 
scriptedmain.shhs
 
<lang haskell>#!/usr/bin/env runhaskell
Line 244 ⟶ 246:
-- Compile:
--
-- rmghc -fforce-recomp -o scriptedmain -main-is ScriptedMain scriptedmain.hihs
-- ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs
 
module ScriptedMain where
Line 261 ⟶ 262:
-- Compile:
--
-- rmghc -fforce-recomp -o test -main-is Test test.hs scriptedmain.hihs
-- ghc -o scriptedmain -main-is ScriptedMain scriptedmain.hs
-- rm scriptedmain.o
-- ghc -o test -main-is Test test.hs scriptedmain.hs
 
module Test where
Anonymous user