4 ms·
Yes, in Haskell the type [Integer] is not a monad. For a type to be an instance of the Monad type class, it must be of kind * -> * . As [Integer] is of kind * ,
by nbouscal 14y ago
Yes, in Haskell the type [Integer] is not a monad. For a type to be an instance of the Monad type class, it must be of kind * -> * . As [Integer] is of kind * , it cannot possibly be an instance of Monad.
- jes5199 14y agoI didn't mean to suggest that [Integer] was of type Monad, I meant that when you write code in terms of the List monad, that code still works and is still valid and is still "monadic" even when the input to that code is a list of a non-polymorphic type.
- nbouscal 14y agoI really don't follow what you're trying to say here. >>= has signature m a -> (a -> m b) -> m b, so clearly you are working with a concrete type m a. The point is that the concrete type isn't what instantiates the Monad type class, the constructor m is.