[Haskell-beginners] Creating modules
Magnus Therning
magnus at therning.org
Fri May 8 10:43:38 UTC 2015
On 8 May 2015 at 11:00, Dananji Liyanage <dan9131 at gmail.com> 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 at therning.org jabber: magnus at therning.org
twitter: magthe http://therning.org/magnus
More information about the Beginners
mailing list