8 Aug
2017
8 Aug
'17
7:56 a.m.
#14100: Nested NPlusKPatterns
-------------------------------------+-------------------------------------
Reporter: ralf | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Nested patterns involving NPlusKPatterns cause a "parse error in pattern".
Example appended below.
> {-# LANGUAGE NPlusKPatterns #-}
> {-# LANGUAGE ViewPatterns, PatternSynonyms #-}
> infix 1 :^:
>
> data Bush elem = Nil | Bud elem | Bush elem :^: Bush elem
> test ((n + 1) + 1) = n
> pattern DivMod2 ∷ (Integral nat) ⇒ nat → nat → nat
> pattern DivMod2 n k ← ((`divMod` 2) → (n, k)) where DivMod2 n k = 2 * n
+ k
> braun ∷ Integer → Bush ()
> braun (0) = Nil
> braun (1) = Bud ()
> braun (DivMod2 n k + 2) = braun (n + k + 1) :^: braun (n + 1)
--
Ticket URL:
GHC
The Glasgow Haskell Compiler