How to preload the module of my own

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to preload the module of my own

z_axis
I want to preload the module automatically when starting ghci. The module located in ~/work directory contains some functions i use everyday.

Now i use an alias: alias ghci='ghci -i ~/work/Money.hs' which works fine. However i feel there maybe are more elegant way.

thanks!
e^(π.i) + 1 = 0
Reply | Threaded
Open this post in threaded view
|

Re: How to preload the module of my own

Alexander Dunlap
On Fri, Sep 4, 2009 at 6:08 PM, zaxis<[hidden email]> wrote:
>
> I want to preload the module automatically when starting ghci. The module
> located in ~/work directory contains some functions i use everyday.
>
> Now i use an alias: alias ghci='ghci -i ~/money/Money.hs' which works fine.
> However i feel there maybe are more elegant way.
>
> thanks!
>

If the module is part of a package you can put 'import NameOfModule'
in your ~/.ghc/.ghci file. That file contains commands that are run
when ghci starts. I'm not sure if you can load a module that isn't
installed.

Alex
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to preload the module of my own

mf-hcafe-15c311f0c

echo ':load ~/money/Money.hs' >> ~/.ghci

works for me.  this adds a line to the startup script that loads a
file that is not in any package.  if this module loads other modules,
you may need to play with ':cd' in addition to ':load'.

hope this helps,
matthias


On Fri, Sep 04, 2009 at 06:14:50PM -0700, Alexander Dunlap wrote:

> To: zaxis <[hidden email]>, Haskell Cafe <[hidden email]>
> Cc:
> From: Alexander Dunlap <[hidden email]>
> Date: Fri, 4 Sep 2009 18:14:50 -0700
> Subject: Re: [Haskell-cafe] How to preload the module of my own
>
> On Fri, Sep 4, 2009 at 6:08 PM, zaxis<[hidden email]> wrote:
> >
> > I want to preload the module automatically when starting ghci. The module
> > located in ~/work directory contains some functions i use everyday.
> >
> > Now i use an alias: alias ghci='ghci -i ~/money/Money.hs' which works fine.
> > However i feel there maybe are more elegant way.
> >
> > thanks!
> >
>
> If the module is part of a package you can put 'import NameOfModule'
> in your ~/.ghc/.ghci file. That file contains commands that are run
> when ghci starts. I'm not sure if you can load a module that isn't
> installed.
>
> Alex
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>  
>  ** ACCEPT: CRM114 PASS osb unique microgroom Matcher **
> CLASSIFY succeeds; success probability: 1.0000  pR: 11.8869
> Best match to file #0 (nonspam.css) prob: 1.0000  pR: 11.8869  
> Total features in input file: 2936
> #0 (nonspam.css): features: 758386, hits: 2835097, prob: 1.00e+00, pR:  11.89
> #1 (spam.css): features: 1686574, hits: 2959087, prob: 1.30e-12, pR: -11.89
>  
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to preload the module of my own

z_axis
My module is not in any package. Your solution is VERY elegant.
thanks!

mf-hcafe-15c311f0c wrote
echo ':load ~/money/Money.hs' >> ~/.ghci

works for me.  this adds a line to the startup script that loads a
file that is not in any package.  if this module loads other modules,
you may need to play with ':cd' in addition to ':load'.

hope this helps,
matthias


On Fri, Sep 04, 2009 at 06:14:50PM -0700, Alexander Dunlap wrote:
> To: zaxis <z_axis@163.com>, Haskell Cafe <haskell-cafe@haskell.org>
> Cc:
> From: Alexander Dunlap <alexander.dunlap@gmail.com>
> Date: Fri, 4 Sep 2009 18:14:50 -0700
> Subject: Re: [Haskell-cafe] How to preload the module of my own
>
> On Fri, Sep 4, 2009 at 6:08 PM, zaxis<z_axis@163.com> wrote:
> >
> > I want to preload the module automatically when starting ghci. The module
> > located in ~/work directory contains some functions i use everyday.
> >
> > Now i use an alias: alias ghci='ghci -i ~/money/Money.hs' which works fine.
> > However i feel there maybe are more elegant way.
> >
> > thanks!
> >
>
> If the module is part of a package you can put 'import NameOfModule'
> in your ~/.ghc/.ghci file. That file contains commands that are run
> when ghci starts. I'm not sure if you can load a module that isn't
> installed.
>
> Alex
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>  
>  ** ACCEPT: CRM114 PASS osb unique microgroom Matcher **
> CLASSIFY succeeds; success probability: 1.0000  pR: 11.8869
> Best match to file #0 (nonspam.css) prob: 1.0000  pR: 11.8869  
> Total features in input file: 2936
> #0 (nonspam.css): features: 758386, hits: 2835097, prob: 1.00e+00, pR:  11.89
> #1 (spam.css): features: 1686574, hits: 2959087, prob: 1.30e-12, pR: -11.89
>  
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
e^(π.i) + 1 = 0