Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve CI and build scripts #3

Merged
merged 7 commits into from
Jul 6, 2023
Merged

improve CI and build scripts #3

merged 7 commits into from
Jul 6, 2023

Conversation

rudymatela
Copy link
Owner

No description provided.

@rudymatela rudymatela self-assigned this Jul 6, 2023
@rudymatela rudymatela added bug Something isn't working enhancement New feature or request labels Jul 6, 2023
... across GHC 9.6 compared to earlier versions.

The following test was failing on GHC 9.6:

```haskell
-- showTypesInTypeOf (u :: Either String Bool -> Maybe Int -> Int -> Bool)
map show . typesIn . typeOf (undefined :: Either String Bool -> Maybe Int -> Int -> Bool)
    == [ "Bool"
       , "Char"
       , "Int"
       , "Maybe Int"
       , "[Char]"
       , "Either [Char] Bool"
       , "Int -> Bool"
       , "Maybe Int -> Int -> Bool"
       , "Either [Char] Bool -> Maybe Int -> Int -> Bool"
       ]
```

Here's what happens on GHC 9.0:

```haskell
> map show . typesIn . typeOf (undefined :: String -> Maybe Int)
[ "Char"
, "Int"
, "Maybe Int"
, "[Char]"
, "[Char] -> Maybe Int"
]
```

Here's what happens on GHC 9.6:

```haskell
> map show . typesIn . typeOf (undefined :: String -> Maybe Int)
[ "Char"
, "Int"
, "[Char]"
, "Maybe Int"
, "[Char] -> Maybe Int"
]
```

The types `[Char]` and `Maybe Int` are reported in a different order!

This relates to the function `compareTy` from `Data.Express.Utils.Typeable`
which is a (tentative) consistent replacement to `compare :: TypeRep -> ...`
over different GHC versions (this was important to some of my research).
It became inconsistent with the new GHC.

```haskell
-- with
> let string = typeOf (undefined :: String)
> let mint = typeOf (undefined :: Maybe Int)

-- on GHC <= 9.4
> compareTy string mint
GT

-- on GHC == 9.6
> compareTy string mint
LT
```

The issue is related to showing the list `TyCon` (`[]`)
which changed to being stringified as `[]` to `List`.

On GHCs 9.0, 9.2, 9.4:

```haskell
> splitTyConApp $ typeOf (undefined :: String)
([],[Char])
```

On GHC 9.6:

```haskell
> splitTyConApp $ typeOf (undefined :: String)
(List,[Char])
```

The function `compareTy` is now amended considering this caveat
and now consistent for all GHCs <= 9.6 and hopefully most future versions.
This is fixed in this commit.
@rudymatela rudymatela merged commit a9f35ae into master Jul 6, 2023
@rudymatela rudymatela deleted the improve-ci-and-bugfix branch July 6, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant