diff options
author | Sebastian Graf <sgraf1337@gmail.com> | 2019-09-18 13:53:34 +0000 |
---|---|---|
committer | Sebastian Graf <sgraf1337@gmail.com> | 2019-09-18 14:08:34 +0000 |
commit | 2efbe6735f9a7579caa180b8d9a464136bef7f2a (patch) | |
tree | 64b2603bb2b385a92110815340497ae5ec3f8bae /testsuite/tests/pmcheck/should_compile/T11822.hs | |
parent | 7915afc6bb9539a4534db99aeb6616a6d145918a (diff) | |
download | haskell-wip/pmcheck-t11822.tar.gz |
Add a regression test for #11822wip/pmcheck-t11822
The particular test is already fixed, but the issue seems to have
multiple different test cases lumped together.
Diffstat (limited to 'testsuite/tests/pmcheck/should_compile/T11822.hs')
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T11822.hs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T11822.hs b/testsuite/tests/pmcheck/should_compile/T11822.hs new file mode 100644 index 0000000000..01afdf46c3 --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T11822.hs @@ -0,0 +1,42 @@ +{-# OPTIONS_GHC -Wincomplete-patterns -fforce-recomp #-} +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE GeneralisedNewtypeDeriving #-} + +module T11822 where + +import Data.Sequence (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 prefix) Depth + | PrefixedMid prefix (Seq SiblingDependencies) (Set prefix) Depth + +mkTreeNode + :: Ord prefix + => prefix + -> Seq SiblingDependencies + -> Set prefix + -> 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 + |