
Hi All, I'm following this lecture[1] series and stuck at the module creation section. Even though I understand the idea of the module I can't figure out the exact syntax to module creation. Do we have to compile the Haskell file containing the module declaration? For an example: Do I have to compile this; module metricCalc(.....) where ... in a file metricCalc.hs [1] http://shuklan.com/haskell/index.html -- Regards, Dananji Liyanage

On 8 May 2015 at 11:00, Dananji Liyanage
Hi All,
I'm following this lecture[1] series and stuck at the module creation section.
Even though I understand the idea of the module I can't figure out the exact syntax to module creation.
Do we have to compile the Haskell file containing the module declaration?
For an example:
Do I have to compile this;
module metricCalc(.....) where ... in a file metricCalc.hs
(First off, I believe module names must start with an uppercase letter, i.e. call it MetricCalc.) It depends on what you mean more exactly. You can use `ghci` to load the source file directly: ~~~ Prelude> :l MetricCalc.hs *MetricCalc> ~~~ If you use Cabal you can compile it and place it in a library which you subsequently can install, so that you can use it from other projects you work on. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus

Thanks Magnus!!
Got it to working.
On Fri, May 8, 2015 at 4:13 PM, Magnus Therning
On 8 May 2015 at 11:00, Dananji Liyanage
wrote: Hi All,
I'm following this lecture[1] series and stuck at the module creation section.
Even though I understand the idea of the module I can't figure out the exact syntax to module creation.
Do we have to compile the Haskell file containing the module declaration?
For an example:
Do I have to compile this;
module metricCalc(.....) where ... in a file metricCalc.hs
(First off, I believe module names must start with an uppercase letter, i.e. call it MetricCalc.)
It depends on what you mean more exactly.
You can use `ghci` to load the source file directly:
~~~ Prelude> :l MetricCalc.hs *MetricCalc> ~~~
If you use Cabal you can compile it and place it in a library which you subsequently can install, so that you can use it from other projects you work on.
/M
-- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards, Dananji Liyanage

On 8 May 2015 at 12:53, Dananji Liyanage
Thanks Magnus!!
Got it to working.
Excellent! I can recommend reading the ghc docs[1], they are good and very readable. Then peruse Hackage to find examples of how things work. /M [1]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus

Thank you very much :)
On Fri, May 8, 2015 at 4:31 PM, Magnus Therning
On 8 May 2015 at 12:53, Dananji Liyanage
wrote: Thanks Magnus!!
Got it to working.
Excellent! I can recommend reading the ghc docs[1], they are good and very readable. Then peruse Hackage to find examples of how things work.
/M
[1]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html
-- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards, Dananji Liyanage

Just a quick note. When you compile (or load in ghci) your Main
module, GHC is smart enough to find other modules it import without
further help. So usually you won't care about compiling/recompiling
distinct modules, only the whole program.
On Fri, May 8, 2015 at 2:05 PM, Dananji Liyanage
Thank you very much :)
On Fri, May 8, 2015 at 4:31 PM, Magnus Therning
wrote: On 8 May 2015 at 12:53, Dananji Liyanage
wrote: Thanks Magnus!!
Got it to working.
Excellent! I can recommend reading the ghc docs[1], they are good and very readable. Then peruse Hackage to find examples of how things work.
/M
[1]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html
-- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards, Dananji Liyanage
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

Noted :)
Thank you!!
On Fri, May 8, 2015 at 9:17 PM, Alexey Shmalko
Just a quick note. When you compile (or load in ghci) your Main module, GHC is smart enough to find other modules it import without further help. So usually you won't care about compiling/recompiling distinct modules, only the whole program.
On Fri, May 8, 2015 at 2:05 PM, Dananji Liyanage
wrote: Thank you very much :)
On Fri, May 8, 2015 at 4:31 PM, Magnus Therning
wrote: On 8 May 2015 at 12:53, Dananji Liyanage
wrote: Thanks Magnus!!
Got it to working.
Excellent! I can recommend reading the ghc docs[1], they are good and very readable. Then peruse Hackage to find examples of how things work.
/M
[1]:
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html
-- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards, Dananji Liyanage
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards, Dananji Liyanage
participants (3)
-
Alexey Shmalko
-
Dananji Liyanage
-
Magnus Therning