[Haskell-cafe] Problem with forall type in type declaration

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Fri May 4 17:12:17 CEST 2012

Sorry to use Monad as the example, I meant this one:
 run :: MonadTrans m => m IO a -> IO a

And Daniel, I do not think adding another type "b" a good idea. Since
"run" could actually return any inside type (depending on another
function that passed to it). Even simple as different tuples would
destroy this solution.

On Fri, May 4, 2012 at 10:05 PM, Daniel Díaz Casanueva
<dhelta.diaz at gmail.com> wrote:
> If one parameter is not enough, you always can add more:
> Test m a b = Test { f :: m IO a -> IO b }
> This way, if
> run :: m IO a -> IO a
> then
> Test run :: Test m a a
> But for other type for your run function
> run' :: m IO a -> IO b
> you get
> Test run' :: Test m a b
> So you can have different types in input and output. Anyway, your type 'm'
> is applied to other two types (m IO a), so it cannot be a monad, because
> monads have arity 1 as type constructors, i.e. monads have kind (* -> *). Is
> perhaps 'm' some kind of monad transformer?
> Well, that's all I can say from your explanation of the problem! Hope it
> helps!
> Daniel Díaz.


And for G+, please use magiclouds#gmail.com.

More information about the Haskell-Cafe mailing list