[Haskell-cafe] Composing functions with runST

Paul Moore p.f.moore at gmail.com
Thu Jan 4 04:03:03 EST 2007

On 1/3/07, Neil Mitchell <ndmitchell at gmail.com> wrote:
> As for beginner issues with rank-2 types, I've been learning Haskell
> for years now, and have never felt the need for a rank-2 type. If the
> interface for some feature requires rank-2 types I'd call that an
> abstraction leak in most cases. It certainly means that you can't
> properly Hoogle for it, can't compile it with Yhc, can't do full type
> inference etc.

That may well be true. Something I forgot to mention in my previous
posting was that I'm not 100% convinced that the issue I hit with
Takusen isn't a problem with the library - I find it very hard to read
or understand some parts of the library documentation, basically
because the types seem so complex. My intuition says that reading a
database is logically similar to reading a file, so types like

doQuery :: (Statement stmt sess q, QueryIteratee (DBM mark sess) q i
seed b, IQuery q sess b) => stmt -> i -> seed -> DBM mark sess seed

look pretty baffling to me - and don't match my intuition that

 main = do
   withSession (connect "user" "password" "server") $ do
     -- simple query, returning reversed list of rows.
     r <- doQuery (sql "select a, b, c from x") query1Iteratee []
     liftIO $ putStrLn $ show r
     otherActions session

is "basically I/O". (Oh, by the way - that "$" on the withSession line
is the one that caused the error which started this thread...)


More information about the Haskell-Cafe mailing list