[Haskell-cafe] FP design
Justin Bailey
jgbailey at gmail.com
Wed Nov 7 17:54:35 EST 2007
> So I'm the one user in a thousand that will want to provide my own I/O
> functions, for example. In the old world, I guess I would be looking
> for some extended API where my I/O functions are parameters to the "open"
> or "init" function, and the IMAP functions take over from there. In a
> more pure functional oriented model, could it be an extended API that
> exposes the IMAP functionality as operations on data, and leaves it to
> me to deal with the I/O?
I believe a typeclass could solve this for you. The typeclass member
functions serve as your interface definition. For example, say "auth"
was a member function. Then you could implement instances which
authorized using NTLM, HTTP Basic, etc.
It's similar to how you'd do the same thing in java with interfaces, in fact.
Justin
More information about the Haskell-Cafe
mailing list