[GHC] #11977: ghc doesn't agree with its own inferred pattern type
GHC
ghc-devs at haskell.org
Thu May 19 07:03:18 UTC 2016
#11977: ghc doesn't agree with its own inferred pattern type
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
| PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
Just fooling around
{{{#!hs
pattern Mempty :: Monoid a => b -> forall x. a -> b
pattern Mempty b <- (($ mempty) -> b)
where Mempty b _ = b
}}}
{{{#!hs
pattern Mempty :: b -> forall a. (Eq a, Monoid a) => a -> b
pattern Mempty b <- (($ mempty @String) -> b)
where Mempty b _ = b
foo :: (forall a. (Eq a, Monoid a) => a -> b) -> b
foo (Mempty x) = x
}}}
{{{
ghci> foo (== mempty)
True
ghci> :t Mempty 'a'
Mempty 'a' :: forall {a}. (Monoid a, Eq a) => a -> Char
ghci> :t foo (Mempty 'a')
foo (Mempty 'a') :: Char
ghci> foo (Mempty 'a')
'a'
}}}
or
{{{#!hs
type MEMPTY b = forall a. (Eq a, Monoid a) => a -> b
pattern Mempty :: b -> MEMPTY b
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11977#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list