[Haskell-cafe] Multi-module scripts

Gregory D. Weber gdweber at iue.edu
Fri Jun 26 15:43:50 EDT 2009


As long as OtherModule is in the same directory, Main should have no
trouble finding it.  

Do you mean like this?


$ ls
Greet.hs  hello*

$ cat hello
#!/usr/bin/env runghc

module Main where
import Greet

main = putStrLn (greet "world")
         
$ cat Greet.hs 
module Greet (greet) where

greet :: String -> String
greet s = "hello " ++ s

$ ./hello
hello world

Greg

On 2009-Jun-26, Maurí­cio wrote:
> Is it possible to write a Haskell script that
> uses a module that is also going to be interpreted?
> Like, say:
>
> #!/usr/bin/runhaskell
>
> module Main (main) where
> import OtherModule
> main = (...)
>
> ----
>
> where OtherModule is available in, say, OtherModule.hs
> and not in the already compiled and installed  library?
>
> Thanks,
> Maurício
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-- 
   ___   ___  __     _      
  / _ \ / _ \| |    | |     Gregory D. Weber, Associate Professor
 / /_\// / | | | /\ | |     Indiana University East
/ /_\\/ /__| | |/  \| |     http://mypage.iu.edu/~gdweber/
\____/\_____/\___/\__/      Tel. (765) 973-8420; FAX (765) 973-8550


More information about the Haskell-Cafe mailing list