[Haskell-cafe] Type classes vr.s functions

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Dec 21 00:35:47 EST 2008


On 2008 Dec 20, at 20:20, Brian Hurt wrote:
> class Fooable a where
>    toFoo :: a -> Foo
> or I can simply have all the functions which need a toFoo take an  
> extra
> agrument.  Performance really isn't that important here, so it's  
> really
> a matter of style- which approach would people prefer in this case?


A third possibility is to use the simple Reader monad ((->) r).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list