Haskell 是否可以使用-XNoImplicitPrelude使提示函数工作?

Haskell 是否可以使用-XNoImplicitPrelude使提示函数工作?,haskell,ghc,ghci,Haskell,Ghc,Ghci,我有一个使用自定义前奏的项目,但是它似乎与我在~/.ghci中的提示功能冲突。简单的例子: $ ghci -XNoImplicitPrelude GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/refold/etc/ghci > :set prompt-function \ms _ -> ms <interactive>:

我有一个使用自定义前奏的项目,但是它似乎与我在
~/.ghci
中的提示功能冲突。简单的例子:

$ ghci -XNoImplicitPrelude
GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/refold/etc/ghci
> :set prompt-function \ms _ -> ms

<interactive>:1:19: error:
    Not in scope: type constructor or class ‘String’

<interactive>:1:30: error:
    Not in scope: type constructor or class ‘Int’

<interactive>:1:37: error:
    Not in scope: type constructor or class ‘IO’

<interactive>:1:40: error:
    Not in scope: type constructor or class ‘String’
$ghci-XNoImplicitPrelude
GHCi,8.2.2版:http://www.haskell.org/ghc/  :? 求救
从/home/refold/etc/GHCi加载的GHCi配置
>:设置提示功能\ms\uux->ms
:1:19:错误:
不在范围内:类型构造函数或类“String”
:1:30:错误:
不在范围内:类型构造函数或类“Int”
:1:37:错误:
不在范围内:类型构造函数或类“IO”
:1:40:错误:
不在范围内:类型构造函数或类“String”

是否可以使
-XNoImplicitPrelude
:设置提示功能
一起工作?

字符串
Int
IO
以及任何必要的内容放回范围。如果
Prelude
不可用(因为使用了
base-noprelude
),可以在它们自己的模块中找到这些类型:

> import Data.String (String)
> import Data.Int (Int)
> import System.IO (IO)
> import Text.Show (show)
> import Control.Applicative (pure)
> :set prompt-function \ms n -> pure (show (ms, n))  -- [String] -> Int -> IO String

谢谢,我已经试过了,但是我的项目使用了
base-noprelude
,并且
base
中的
Prelude
与我项目中的冲突。由于某些原因,它也不适用于
PackageImports
。理想情况下,有一种方法可以只为提示函数范围导入内容,就像OCaml中的本地导入一样。类型也可以在其他模块中导出。我更新了我的答案。好的,谢谢,如果我在
:m-Data.String Data.Bool Data.List Data.Eq Data.Function Data.Int System.IO Text.Show Control.Monad
之后添加一些类似的内容:在我的
~/.ghci
中设置提示功能,我可以模拟本地导入,并得到一个没有噪音的干净提示。