[GHC] #13735: RankNTypes don't work with PatternSynonyms
GHC
ghc-devs at haskell.org
Sun May 21 01:11:36 UTC 2017
#13735: RankNTypes don't work with PatternSynonyms
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
PatternSynonyms |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{#!hs
data PLambda a = Var a | Int Int | Bool Bool | If (PLambda a) (PLambda a)
(PLambda a)
| Add (PLambda a) (PLambda a) | Mult (PLambda a) (PLambda a)
| Eq (PLambda a) (PLambda a) | Lam (a -> PLambda a)
| App (PLambda a) (PLambda a)
newtype Lam = L { un :: forall a. PLambda a }
}}}
{{{#!hs
llam :: (forall a. a -> PLambda a) -> Lam
llam f = L (Lam f)
}}}
works fine, but does not with pattern synonyms:
{{{
-- $ ghci -ignore-dot-ghci tirr.hs
-- GHCi, version 8.2.0.20170507: http://www.haskell.org/ghc/ :? for help
-- [1 of 1] Compiling Main ( tirr.hs, interpreted )
--
-- tirr.hs:20:25: error:
-- • Couldn't match expected type ‘forall a. a -> PLambda a’
-- with actual type ‘a0 -> PLambda a0’
-- • In the declaration for pattern synonym ‘LLam’
-- • Relevant bindings include
-- a :: a0 -> PLambda a0 (bound at tirr.hs:20:25)
-- |
-- 20 | pattern LLam a = L (Lam a)
-- | ^
-- Failed, modules loaded: none.
-- Prelude>
pattern LLam :: (forall a. a -> PLambda a) -> Lam
pattern LLam a = L (Lam a)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13735>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list