implement merge via typeclass