-
Notifications
You must be signed in to change notification settings - Fork 38
Monad.unit method purpose #4
Comments
It wraps a value in the monad. It's there for completeness more than anything else, since the static constructors are more useful. |
I had a look to the What's I don't understand is, why isn't it a static function ? What did I miss ? |
IIRC my reasoning was this: it could work as a static function, but all things considered it was slightly better to have it as an instance method (compatible with Fantasy Land) and use the more readable static constructors. If it was static, you unfortunately wouldn't get the ad-hoc polymorphism of Haskell. It would still be necessary to explicitly say which monad's unit implementation you wanted, e.g. |
Ok, I got it. Thanks a lot. |
Hi,
I was studying the library API and ends up on
Monad.unit
method.I have some thought about the purpose of this method but I am not sure.
Can you enlighten me?
Thanks.
The text was updated successfully, but these errors were encountered: