Thanks! Serious food for thought.
Ten years of object oriented brainwashing to undo :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Adde:
> Thanks, using pattern matching to avoid mentioning the type didn't even
> cross
> my mind.
> You are correct in assuming that I thought I could get away
> with "getConnection :: Connection c => Transaction c". To be honest, I
> still
> don't understand why it's too polymorphic. To me it
Chris Kuklewicz list.mightyreason.com> writes:
> Searching the haskell wiki for MonadIO gives several examples.
>
> http://haskell.org/haskellwiki/New_monads/MonadExit
>
> > instance MonadIO m => MonadIO (ExitT e m) where
> > liftIO = lift . liftIO
>
> Where you can see you are just delegati
Adde wrote:
>> 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 => Tran
> 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 =
Matthew Brecknell brecknell.org> writes:
> Since the concrete type has been forgotten, there's no way to get it
> back. You can't write a function that exposes the forgotten type, so
> getConnection is basically a lost cause. When you write "getConnection
> :: Transaction c", you are saying that
> I can't seem to find any examples of how to actually implement liftIO for a
> monad. Any ideas/pointers?
>
Searching the haskell wiki for MonadIO gives several examples.
http://haskell.org/haskellwiki/New_monads/MonadExit
> instance MonadIO m => MonadIO (ExitT e m) where
> liftIO = lift .
Martin Huschenbett gmx.org> writes:
>
> Hi,
>
> instead of writing a function getTransaction that retrieves the
> connection you could write a function withConnection that doesn't return
> the connection itself but performs an operation on the connection:
>
> withConnection ::
> (foral
Hi,
instead of writing a function getTransaction that retrieves the
connection you could write a function withConnection that doesn't return
the connection itself but performs an operation on the connection:
withConnection ::
(forall c. Connection c => c -> Transaction a) -> Transacti
Adde wrote:
> I'm experimenting with implementing database transactions as monads but I'm
> getting stuck on how to store a generic connection (only constrained by a
> typeclass) inside the transaction. The reason I'm doing it this way is that
> the connection could be a different kind of struct
10 matches
Mail list logo