Re: [Haskell-cafe] Is this the right way to do polymorphism?

2011-01-08 Thread Henning Thielemann
On Fri, 7 Jan 2011, Daryoush Mehrtash wrote: -- | Performs a signed request with the available token. serviceRequest :: (HttpClient c,MonadIO m) = c - OAuthRequest - OAuthMonadT m Response serviceRequest c req = do { result - lift $ runClient c (unpackRq req) I do not see, why different

[Haskell-cafe] Is this the right way to do polymorphism?

2011-01-07 Thread Daryoush Mehrtash
I am trying to evaluate the polymorphism technique used in Hackage library. I like to know if the approach taken is right or not. The code in question is in the Hoaut package http://hackage.haskell.org/package/hoauth/ As far as I can understand the code wants to have polymorphism on HTTP client

Re: [Haskell-cafe] Is this the right way to do polymorphism?

2011-01-07 Thread Luke Palmer
If you always expect to be passing c as a parameter and never returned, it is probably better off as a data type. Eg. HTTPClient might look like a traditional OO class: class HTTPClient c where foo :: c - stuff bar :: c - stuff I've found that it is easier to work with if