[Haskell-cafe] Hint's setImports usage
Martin Hilbig
lists at mhilbig.de
Fri Dec 21 02:02:50 CET 2012
On 21.12.2012 01:23, Michael Sloan wrote:
> Yeah, I've run into that too..
>
> It does seem like there ought to be a better way, but in order to get
> around that, I just define the imports (or generate) "MyPrelude.hs" in
> the current directory.
what do you do with the file then? neither loadModules, setImports,
setTopLevelModules helped me :/
have fun
martin
> That file can just consist of "import
> OtherPackage.MyPrelude".
>
> -Michael
>
>
> On Thu, Dec 20, 2012 at 4:12 PM, Martin Hilbig <lists at mhilbig.de
> <mailto:lists at mhilbig.de>> wrote:
>
> oh that's neat!
>
> but what to do if MyPrelude is provided by some package?
>
> i get this error:
>
> module `MyPrelude' is a package module
>
> and neither
>
> set [languageExtensions := [PackageImports]]
>
> nor
>
> {-# LANGUAGE PackageImports #-}
>
> helps.
>
> have fun
> martin
>
>
> On 21.12.2012 00:55, Michael Sloan wrote:
>
> Hello!
>
> Try doing this first:
>
> loadModules ["My.Module"]
>
> You may also need to set the "searchPath" - it defaults to the
> current
> director. Another good function to know about is
> "setTopLevelModules",
> which is just like using ":load" in ghci - it imports everything
> in the
> module, including its imports. So, I often do:
>
> loadModules ["MyPrelude"]
> setTopLevelModules ["MyPrelude"]
>
> And stick all of the things that I want to be in scope into
> "MyPrelude.hs".
>
> -Michael
>
>
> On Thu, Dec 20, 2012 at 3:35 PM, Martin Hilbig <lists at mhilbig.de
> <mailto:lists at mhilbig.de>
> <mailto:lists at mhilbig.de <mailto:lists at mhilbig.de>>> wrote:
>
> hi,
>
> how to use Language.Haskell.Interpreter.____setImports?
>
>
> i use it like:
>
> setImports ["My.Module"]
>
> so that my interpreted modules don't need to:
>
> import My.Module
>
> But i still get:
>
> Not in scope: data constructor `MyType'
>
> What am i doing wrong?
>
> Thanks in advance.
>
> have fun
> martin
>
> ___________________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org <mailto:Haskell-Cafe at haskell.org>
> <mailto:Haskell-Cafe at haskell.__org
> <mailto:Haskell-Cafe at haskell.org>>
> http://www.haskell.org/____mailman/listinfo/haskell-cafe
> <http://www.haskell.org/__mailman/listinfo/haskell-cafe>
> <http://www.haskell.org/__mailman/listinfo/haskell-cafe
> <http://www.haskell.org/mailman/listinfo/haskell-cafe>>
>
>
>
More information about the Haskell-Cafe
mailing list