Is it possible to emulate a function using your own data type?
Is it possible to emulate a function with your own data type with some GHC extension? What I want to do is e.g. (imaginary syntax) data MyFunc = MyFunc String (Int->Int) instance (Int->Int) MyFunc where ($) (MyFunc _ f) i = f i inc = MyFunc "increment" (1+) test = inc 1 I.e. data that carries some meta-information with it and can be pattern matched, but which can still be called like a regular function. Now, I know that I could define my own infix operator like $$ and call inc $$ 1 , but being able to use the regular function call syntax would be very useful in embedded DSLs. Yes, it can be