Skip to content

Solution to regular expression is no longer valid

The following HUnit test code

module Main where
import Test.HUnit
import Text.Regex.Posix 

testRegexSimple :: Test
testRegexSimple = TestCase $ do
    assertBool "pattern matches regex ^(a)|(p)$" ( "p" =~ "^(a)|(p)$" )

testRegex :: Test
testRegex = TestCase $ do
    assertBool "pattern matches regex ^(ab+c*d?)|(ef{2}g{3,6}h{3,})|(p)$" ( "p" =~ "^(ab+c*d?)|(ef{2}g{3,6}h{3,})|(p)$" )

tests = TestList [
        TestLabel "Regex Simple"         testRegexSimple,
        TestLabel "Regex"                testRegex
    ]

main :: IO Counts
main = do runTestTT tests

runs perfectly using Haskell platform 2013.2.0.0 with ghc 7.6.3.

However, on stack LTS 7.13 with ghc 8.0.1 the second test fails! I assume this behaviour is the result of a bug.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown/Multiple
Architecture Unknown/Multiple
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information