Skip to content

Instantly share code, notes, and snippets.

@dmwit
Created March 19, 2019 22:07
Show Gist options
  • Save dmwit/47a3435d1c16a532e24c9f156da0dae6 to your computer and use it in GitHub Desktop.
Save dmwit/47a3435d1c16a532e24c9f156da0dae6 to your computer and use it in GitHub Desktop.
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE TypeFamilies #-}
import GHC.Exts
class (forall a. A t a => A t [a]) => B t where type A t a :: Constraint
instance B t => B [t] where type A [t] a = A t a
@dmwit
Copy link
Author

dmwit commented Mar 19, 2019

test.hs:5:10: error:
    • Could not deduce: A t [a]
        arising from the superclasses of an instance declaration
      from the context: B t
        bound by the instance declaration at test.hs:5:10-21
      or from: A [t] a bound by a quantified context at test.hs:1:1
    • In the instance declaration for ‘B [t]’
  |
5 | instance B t => B [t] where type A [t] a = A t a
  |          ^^^^^^^^^^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment