Skip to content

QuantifiedConstraints and principal types

This is not a bug but I am trying to understand the ~~implication~~ significance of -XQuantifiedConstraints.

OutsideIn(X) (section **2.4**) tells us test actually has a principal type when we have implication constraints)

data T :: Type -> Type where
  T1 :: Int -> T Bool
  T2 ::        T a

test :: (a~Bool => b~Bool) => T a -> b -> b
test (T1 n) _ = n > 0
test T2     r = r

that subsumes

test1 :: T a -> a -> a
test1 = test

test2 :: T a -> Bool -> Bool
test2 = test

Now that we have -XQuantifiedConstraints does this change the story at all, if not you can close this..

Edited by Icelandjack
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information