[GHC] #12087: Inconsistency in GADTs?
GHC
ghc-devs at haskell.org
Wed Jun 28 15:48:24 UTC 2017
#12087: Inconsistency in GADTs?
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: RyanGlScott
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: GADTs
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #11540 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Replying to [comment:4 simonpj]:
> I agree this is possible in principle but it is fiddly in practice.
What about
> {{{
> MkF :: Ord a => a -> Eq a => F a
> }}}
> which ought to work too.
Sure, I completely agree. `tcSplitNestedSigmaTys` can handle that case, so
`tcSplitNestedLHsSigmaTys` ought to as well.
> > This isn't exactly what the user wrote, but it's equivalent and
serviceable.
>
> Yes but we'll soon have people asking that `:t MkF` prints out the type
they wrote.
We can cross that bridge when we come to it.
FWIW, GHC doesn't have a solid track record of preserving nested sigma
types for functions either:
{{{
λ> let f :: Ord a => Eq a => a -> Bool; f = undefined
λ> :type f
f :: Ord a => a -> Bool
λ> let g :: Ord a => a -> Eq a => a; g = undefined
λ> :type g
g :: Ord a1 => a2 -> a1
}}}
So it (personally) wouldn't bother me to have `:type MkF` print out
something slightly different than what I typed. After all, if I'm using
nested sigma types in the first place, there's a good chance I know why
GHC's displayed type is tweaked (but equivalent).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12087#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list