Is there a way to have the compiler derive the functionality that I would write manually as:
instance Class c => Class (Trans c) where
foo1 = lift foo1
foo2 = lift foo2
...
foo999 = lift foo999
bar1 = \a b c -> lift $ bar1 a b c
...
baz1 = lift . baz1
...
i.e. when a type of class Class
is being wrapped in Trans
, is it possible to get a free instance of Class
for Trans
automatically without having to do the heavy lifting :)?
c
, so you only have to write it once. I don't think it can be made any shorter, in the general case. – chifooX = lift fooX
etc.) – jakubdanielGeneralizedNewtypeDeriving
? downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/… – Michael