Created
September 25, 2019 12:18
-
-
Save kosmikus/7ab13c90134640d4ad62c69233ea152e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment