Skip to content

Commit

Permalink
fix build of tests on GHC 9.10 (List)
Browse files Browse the repository at this point in the history
Data.List from GHC 9.10 now exports a "List" constructor.  The files
test/express-derive.hs and test/name-derive.hs both had constructors named
"List" causing an error.

This change renames both these test constructors to "Lst" instead.

This was the error before this change:

    $ make test-with-ghc-9.10
    ...
    ghc-9.10 -isrc:test:../leancheck/src -O2 -v0 -dynamic test/express-derive.hs && touch test/express-derive
    test/express-derive.hs:11:22: error: [GHC-87543]
        Ambiguous occurrence ‘List’.
        It could refer to
           either ‘Test.List’,
                  imported from ‘Test’ at test/express-derive.hs:6:1-32
                  (and originally defined in ‘GHC.Types’),
               or ‘Main.List’, defined at test/express-derive.hs:11:1.
       |
    11 | data List a  =  a :- List a | Nil deriving (Show, Eq, Typeable)
       |                      ^^^^
  • Loading branch information
rudymatela committed Jan 29, 2025
1 parent c183ea9 commit fc8781f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions test/express-derive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import Test hiding ((-:), (->:))

data Choice = Ae | Bee | Cee deriving (Show, Eq, Typeable)
data Peano = Zero | Succ Peano deriving (Show, Eq, Typeable)
data List a = a :- List a | Nil deriving (Show, Eq, Typeable)
data Lst a = a :- Lst a | Nil deriving (Show, Eq, Typeable)
data Bush a = Bush a :-: Bush a | Leaf a deriving (Show, Eq, Typeable)
data Tree a = Node (Tree a) a (Tree a) | Null deriving (Show, Eq, Typeable)

deriveExpress ''Choice
deriveExpress ''Peano
deriveExpress ''List
deriveExpress ''Lst
deriveExpress ''Bush
deriveExpress ''Tree

deriveListable ''Choice
deriveListable ''Peano
deriveListable ''List
deriveListable ''Lst
deriveListable ''Bush
deriveListable ''Tree

Expand Down Expand Up @@ -73,8 +73,8 @@ tests n =
, holds n (exprIsVal :: Choice -> Bool)
, fails n (exprIsVal :: Peano -> Bool)

, fails n (exprIsVal :: List Int -> Bool)
, fails n (exprIsVal :: List Bool -> Bool)
, fails n (exprIsVal :: Lst Int -> Bool)
, fails n (exprIsVal :: Lst Bool -> Bool)

, fails n (exprIsVal :: Bush Int -> Bool)
, fails n (exprIsVal :: Bush Bool -> Bool)
Expand All @@ -85,8 +85,8 @@ tests n =
, holds n (exprIsValUnderEvaluate :: Choice -> Bool)
, holds n (exprIsValUnderEvaluate :: Peano -> Bool)

, holds n (exprIsValUnderEvaluate :: List Int -> Bool)
, holds n (exprIsValUnderEvaluate :: List Bool -> Bool)
, holds n (exprIsValUnderEvaluate :: Lst Int -> Bool)
, holds n (exprIsValUnderEvaluate :: Lst Bool -> Bool)

, holds n (exprIsValUnderEvaluate :: Bush Int -> Bool)
, holds n (exprIsValUnderEvaluate :: Bush Bool -> Bool)
Expand Down
8 changes: 4 additions & 4 deletions test/name-derive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Test
import Data.Express.Utils.List

data Peano = Zero | Succ Peano deriving Show
data List a = a :- List a | Nil deriving Show
data Lst a = a :- Lst a | Nil deriving Show
data Bush a = Bush a :-: Bush a | Leaf a deriving (Show, Eq)
data Tree a = Node (Tree a) a (Tree a) | Null deriving (Show, Eq)

Expand All @@ -25,7 +25,7 @@ instance Num Peano where
Succ n - Succ m = n - m

deriveName ''Peano
deriveName ''List
deriveName ''Lst
deriveName ''Bush
deriveName ''Tree

Expand Down Expand Up @@ -56,10 +56,10 @@ tests n =
[ True

, name (undefined :: Peano) == "x"
, name (undefined :: List Int) == "l"
, name (undefined :: Lst Int) == "l"
, name (undefined :: Bush Int) == "b"
, name (undefined :: Tree Int) == "t"
, name (undefined :: List Bool) == "l"
, name (undefined :: Lst Bool) == "l"
, name (undefined :: Bush Bool) == "b"
, name (undefined :: Tree Bool) == "t"

Expand Down

0 comments on commit fc8781f

Please sign in to comment.