【发布时间】:2016-03-05 19:19:36
【问题描述】:
我已经看到pure 1的类型是(Num a, Applicative f) => f a,这很明显。
所以如果我想让它成为Maybe Int:
Prelude> pure 1 :: Maybe Int
Just 1
这个怎么样?
Prelude> pure 1
1
Prelude> return 1
1
发生了什么事?为什么不抱怨不知道选择哪个实例??
编辑
我认为这种行为实际上与 monads 或 applicatives 无关,但这是我来到它的上下文......
【问题讨论】:
-
见
return Truein I/O actions at the prompt
标签: haskell monads applicative