[Haskell-cafe] How to "Show" an Operation?

Evan Laforge qdunkan at gmail.com
Mon Jun 7 14:40:22 EDT 2010


> How should I work around that. I could use two different "name" function, but
> I don't like this. Would I have to define a typeclass "namedFunction" which
> all have a "name" function?

How about a "named" type:

data Named a = Named {
  val_of :: a,
  name_of :: String
  }

You can put it in Functor and Applicative to get some nice syntax for
modifying the value.


More information about the Haskell-Cafe mailing list