简体   繁体   English

如何在 haskell 中更改为前奏控制台以执行单子

[英]how to change to prelude console in haskell for execution of monads

Hi I am trying to run a custom monad by using prelude as suggested here: Calling a custom monad in haskell using the bind , by using Prelude Control.Monad> runCustomM cm "foo"嗨,我正在尝试使用这里建议的 prelude 来运行自定义 monad: Calling a custom monad in haskell using the bind , by using Prelude Control.Monad> runCustomM cm "foo"

However when I try to do the import Control.Monad nothing happens an the prompt type doesn't change.但是,当我尝试import Control.Monad时,提示类型不会发生任何变化。 Likewise nothing happens when I use the System.IO as suggested here: https://downloads.haskell.org/~ghc/8.4.2/docs/html/users_guide/ghci.html Likewise nothing happens when I use the System.IO as suggested here: https://downloads.haskell.org/~ghc/8.4.2/docs/html/users_guide/ghci.html

How can I execute the prelude correctly st I can execute my own Monads?我怎样才能正确地执行前奏我可以执行我自己的 Monads?

I tried我试过了

Loaded package environment from C:\Users\tqx98\AppData\Roaming\ghc\x86_64-mingw32-9.0.1\environments\default
GHCi, version 9.0.1: https://www.haskell.org/ghc/  :? for help

ghci> import Control.Monad
ghci> import System.IO 
ghci> 

The above is more or less all that happens.以上或多或少是所有发生的事情。

When I try to do the import Control.Monad nothing happens an the prompt type doesn't change.当我尝试import Control.Monad时,提示类型不会改变。

This appears to be the expected behaviour in your version of GHCi, see the documentation of v9.0.1 (contrasting with that of v8.4.2 which you linked).这似乎是您的 GHCi 版本中的预期行为,请参阅v9.0.1 的文档(与您链接的 v8.4.2的文档形成对比)。 In my experience, the long prompt was quite annoying when importing a lot of modules, so I'd consider it an improvement.以我的经验,导入大量模块时,长提示非常烦人,所以我认为这是一种改进。

It just be working just fine to call the functions from the imported modules.从导入的模块中调用函数就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM