Skip to content

Instantly share code, notes, and snippets.

@cdornan
Created July 2, 2022 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdornan/f75cd8024434d998c87610cbb7fb6ab3 to your computer and use it in GitHub Desktop.
Save cdornan/f75cd8024434d998c87610cbb7fb6ab3 to your computer and use it in GitHub Desktop.
Between Haskell2010 and GHC2021
{-# LANGUAGE DerivingVia #-}
module Phantoms where
import Data.Typeable
class C a where
cmethod :: Proxy a -> ()
class (Show a, Typeable a) => S a where
smethod :: a -> Int
newtype UsingD a = UsingD { getUsingD :: a }
newtype D a = D { getD :: Int }
deriving (Show) via UsingD (D a)
instance (C a,Typeable a) => S (D a) where smethod = undefined
instance (C a,Typeable a) => Show (UsingD a) where showsPrec = undefined
instance (C a) => C (D a) where cmethod _ = undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment