ekmett / transformers-compat

transformers compatibility shim
Other
10 stars 12 forks source link

Seems there are no Typeable1 Compose (GHC-7.4) #45

Open phadej opened 5 years ago

phadej commented 5 years ago

Neither Typeable1 Product

Also with GHC-7.6

transformers-0.5.6.2 uses AutoDeriveTypeable GHC >=7.8 https://hackage.haskell.org/package/transformers-0.5.6.2/src/legacy/pre711/Data/Functor/Compose.hs


Oh, is it because

    Can't make a derived instance of `Typeable1 (Compose f g)':
      `Compose' must only have arguments of kind `*'
    In the stand-alone deriving instance for `Typeable1 (Compose f g)'
phadej commented 5 years ago
instance (Typeable1 f, Typeable1 g) => Typeable1 (Product f g) where
    typeOf1 _ = mkTyConApp
        (mkTyCon3 "transformers" "Data.Functor.Product" "Product")
        [typeOf1 (undefined :: f ()), typeOf1 (undefined :: f ())]

instance (Typeable1 f, Typeable1 g) => Typeable1 (Compose f g) where
    typeOf1 _ = mkTyConApp
        (mkTyCon3 "transformers" "Data.Functor.Compose" "Compose")
        [typeOf1 (undefined :: f ()), typeOf1 (undefined :: f ())]

seems to work, but not sure how correct it is. At least package name have to be #ifed, I guess.

RyanGlScott commented 5 years ago

Pull requests are welcome, if you're willing to figure out the right combination of CPP to make this work.