Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE DerivingVia, ScopedTypeVariables, StandaloneDeriving, TypeApplications, TypeFamilies #-}
- module DataFamilyDerivingVia where
- import Data.Coerce
- data family Foo a
- newtype ByBar a = ByBar a
- class Baz a where
- baz :: a -> a
- instance Baz (ByBar a) where
- baz = id
- -- deriving via ByBar (Foo a) instance Baz (Foo a)
- instance Baz (Foo a) where
- baz = coerce @(ByBar (Foo a) -> ByBar (Foo a)) @(Foo a -> Foo a) baz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement