
9 Jun
2010
9 Jun
'10
6:33 p.m.
On Monday, 7. June 2010 23:28:08 Evan Laforge wrote:
I just meant you could add instances:
instance Functor (Named a) where fmap f named = named { val_of = f (val_of named) } instance Applicative (Named a) where ... likewise, but maybe not a great fit unless you have a "no name" for 'pure'
So far so good. However my "Named" things are all functions and I don't see I ever want to map over any of them. But what I'd like to do is use them like ordinary functions as in: f::Named (Int->Int) f x Is there a way to do this, other than writing apply::Named Int ->Int apply n x = (val_of n) x -- Martin