haskellfoundation / haskellfoundation/stability

Breaking changes in time 1.15 (GHC 9.14)

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
29
Forks
3
PR merge metrics
No merged PRs in 30d

Description

At work, we maintain source compatability across up to 3 GHC versions. Right now, that is 9.10, 9.12 and (in progress) 9.14.

time 1.15, which ships with 9.14, introduced three new pattern constructors that are now exported from Data.Time and [Data.Time.Clock](https://hackage-content.haskell.org/package/time-1.15/docs/Data-Time-Clock.html#:~:text=pattern%20Hours): Hours, Minutes and Seconds.

These patterns were not present in time 1.14 (GHC 9.12) or 1.12 (GHC 9.10); our codebase has already defined newtypes with the same names (and different semantics). These new imports cause ambiguities in our code where we are importing our own types and Data.Time or Data.Time.Clock.

We need to be more disciplined about unqualified imports, but its a large codebase that's developed over many years so that is a long-term process.

In order to remain source compatible, I've decided to use the "Extended" modules pattern, so one module can hide these new constructors:

```
{-# OPTIONS_GHC "-fno-dodgy-imports" #-}
module Data.Time.Extended
(module X)

where

import Data.Time hiding (Hours, Minutes, Seconds) as X
```

(and, via "-fno-dodgy-imports", I'm able to use that for 9.10 and 9.12 as well; I abhor CPP). However, it would be a lot more pleasant if these new patterns didn't exist at all.

I'll post to the discourse as well, but wanted to bring this to your attention. Thank you!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.