[GHC] #14993: QuantifiedConstraints and principal types
GHC
ghc-devs at haskell.org
Tue Apr 3 18:32:25 UTC 2018
#14993: QuantifiedConstraints and principal types
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Resolution: | Keywords:
| QuantifiedConstraints, wipT2893
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:
Old description:
> This is not a bug but I am trying to understand the ~~implication~~
> significance of `-XQuantifiedConstraints`.
>
> [https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/jfp-
> outsidein.pdf OutsideIn(X)] (section **2.4**) tells us `test` actually
> has a principle type when we have implication constraints)
>
> {{{#!hs
> 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
>
> {{{#!hs
> 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..
New description:
This is not a bug but I am trying to understand the ~~implication~~
significance of `-XQuantifiedConstraints`.
[https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/jfp-
outsidein.pdf OutsideIn(X)] (section **2.4**) tells us `test` actually has
a principal type when we have implication constraints)
{{{#!hs
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
{{{#!hs
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..
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14993#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list