[Haskell-cafe] Takusen and iteratee problem
Jason Dagit
dagit at codersbase.com
Fri Mar 19 19:31:14 EDT 2010
On Fri, Mar 19, 2010 at 2:17 PM, Vasyl Pasternak
<vasyl.pasternak at gmail.com>wrote:
> Hello Cafe.
>
> Today I stuck with the following problem: I want to read a file with
> iteratee package, and but it to database through Takusen package, but
> it doesn't work. The `Takusen` was built with `mtl` package, and
> `iteratee` - with `transformers`, so they are conflicting when used
> simultaneously.
>
> To be concrete, I want to run the code, that looks like:
>
> withSession (connect "dbname.db") (do
> execDDL (sql "create table x (value string)")
> fillFromFile "file.dat"
> )
>
> fillFromFile fname = fileDriverFd iter fname
>
> iter = iterator that uses execDML (sql "Insert into ...." )....
>
> I have no ideas how to solve the problem, so appreciate any
> recommendations, that will make it possible.
>
I'm a bit of a Takusen newbie, but I've been maintaining some code recently
that makes use of it. I've coded up some trivial examples using the
iteratees package. Based on my very shallow understanding, I think the
problem is just that both packages define iteratees but differently.
Assuming that's correct, then I think you need a way to transform between
the two types of iteratees. Perhaps that can be done with an enumerator
that fetches values from your fillFromFile iteratee and turns that into the
type of iteratee that Takusen uses?
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100319/01056552/attachment.html
More information about the Haskell-Cafe
mailing list