Haskell 为什么ghci不';t识别inits函数

Haskell 为什么ghci不';t识别inits函数,haskell,Haskell,我正在使用ghci,当我尝试使用“inits”函数时,出现错误: Not in scope: `inits' Perhaps you meant `init' (imported from Prelude) 但该函数应根据以下内容预定义: 我做错了什么?您需要导入数据。列表: :m +Data.List inits [[1,2],[3,4]] 或者,您可以使用全名 Data.List.inits [[1,2],[3,4]] 您需要导入数据。列表: :m +Data.List in

我正在使用ghci,当我尝试使用“inits”函数时,出现错误:

Not in scope: `inits'
    Perhaps you meant `init' (imported from Prelude)
但该函数应根据以下内容预定义:


我做错了什么?

您需要导入
数据。列表

:m +Data.List
inits [[1,2],[3,4]]
或者,您可以使用全名

Data.List.inits [[1,2],[3,4]]

您需要导入
数据。列表

:m +Data.List
inits [[1,2],[3,4]]
或者,您可以使用全名

Data.List.inits [[1,2],[3,4]]

如果每次打开ghci时使用ghci.conf中的函数足够频繁,以避免导入数据,则可以将数据.List添加到ghci.conf中。如果每次打开ghci时使用ghci.conf中的函数足够频繁,以避免导入数据.List,则可以将数据.List添加到ghci.conf中。