[Haskell-cafe] Re: Foralls in records

Adde adde at trialcode.com
Wed Mar 14 11:08:11 EDT 2007


> Do you want to mix differently typed Connections inside a single
> transaction? It looks like you don't, so you may well leave out
> existential types altogether and simply parametrize the Transaction
> monad on the type of the connection it uses.
> 
>   data Connection c => TransactionState c = TS c
>   data Transaction c a =
>      Transaction (TransactionState c -> (a, TransactionState c)
> 
>   instance Monad (Transaction c) where ...
> 
>   getConnection :: Transaction c c
>   ...
> 
> Note that Control.Monad.State does the same.
> 
> Regards,
> apfelmus

You are correct in that I don't want to mix different kind of connections 
inside a single transaction. I just didn't want to have to parameterize every 
single function using the monad.

doSomething :: Transaction FirebirdConnection ()

doSomethingElse :: Transaction FirebirdConnection ()

Maybe I'm misunderstanding something but as I see it that would kind of stop 
me from running doSomething and doSomethingElse using different kinds of 
databases.




More information about the Haskell-Cafe mailing list