Skip to content

Breaking changes in time 1.15 (GHC 9.14) #20

@m4dc4p

Description

@m4dc4p

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: 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions