[GHC] #11822: Pattern match checker exceeded (2000000) iterations
GHC
ghc-devs at haskell.org
Thu Feb 7 22:34:58 UTC 2019
#11822: Pattern match checker exceeded (2000000) iterations
-------------------------------------+-------------------------------------
Reporter: j.waldmann | Owner: gkaracha
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1-rc3
Resolution: | Keywords:
| PatternMatchWarnings
Operating System: Unknown/Multiple | Architecture: x86_64
Type of failure: Compile-time | (amd64)
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by dbaynard):
I've just encountered this (on 8.6.3) while making some changes to stack.
I'll try an option which doesn't need to do so much checking. But this
appears much smaller than the previous examples here.
{{{#!haskell
{#- LANGUAGE OverloadedLists -#}
{#- LANGUAGE PatternSynonyms -#}
{#- LANGUAGE GeneralisedNewtypeDeriving -#}
import Data.Seq (Seq, pattern (:<|))
import Data.Set (Set)
newtype SiblingDependencies = SiblingDependencies Int
deriving (Eq, Ord, Enum, Integral, Real, Num)
newtype Depth = Depth Int
deriving (Eq, Ord, Enum, Integral, Real, Num)
data TreeNode prefix
= OnlyChild prefix
| LeafLast prefix
| LeafMid prefix
| NodeLast prefix
| NodeMid prefix
| PrefixedLast prefix (Seq SiblingDependencies) (Set PackageName) Depth
| PrefixedMid prefix (Seq SiblingDependencies) (Set PackageName) Depth
mkTreeNode
:: prefix
-> Seq SiblingDependencies
-> Set PackageName
-> Depth
-> TreeNode prefix
mkTreeNode t [] _ _ = OnlyChild t
mkTreeNode t [0] [] _ = LeafLast t
mkTreeNode t [_] [] _ = LeafMid t
mkTreeNode t [0] _ 0 = LeafLast t
mkTreeNode t [_] _ 0 = LeafMid t
mkTreeNode t [0] _ _ = NodeLast t
mkTreeNode t [_] _ _ = NodeMid t
mkTreeNode t (0 :<| ns) ds depth = PrefixedLast t ns ds depth
mkTreeNode t (_ :<| ns) ds depth = PrefixedMid t ns ds depth
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11822#comment:22>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list