How to preload the module of my own

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! -- View this message in context: http://www.nabble.com/How-to-preload-the-module-of-my-own-tp25304154p2530415... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

On Fri, Sep 4, 2009 at 6:08 PM, zaxis
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

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
, Haskell Cafe Cc: From: Alexander Dunlap 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
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

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
, Haskell Cafe Cc: From: Alexander Dunlap 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
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
-- View this message in context: http://www.nabble.com/How-to-preload-the-module-of-my-own-tp25304154p2530464... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
participants (3)
-
Alexander Dunlap
-
mf-hcafe-15c311f0c@etc-network.de
-
zaxis