Skip to content

Difference in DuplicateRecordFields between 8.4 and 8.6

Wat.hs

{-# LANGUAGE DuplicateRecordFields #-}

module Wat where

data Record = Record { distinct :: String }

Foo.hs

module Foo where

import Wat (distinct)

showDistinct = show . distinct

Compiling with 8.6.4, installed from binary distribution:

> ghc-8.6.4 Wat.hs Foo.hs
[1 of 2] Compiling Wat              ( Wat.hs, Wat.o )
[2 of 2] Compiling Foo              ( Foo.hs, Foo.o )

Compiling with 8.4.4, installed from binary distribution:

> ghc-8.4.4 Wat.hs Foo.hs
[1 of 2] Compiling Wat              ( Wat.hs, Wat.o )
[2 of 2] Compiling Foo              ( Foo.hs, Foo.o )

Foo.hs:3:13: error: Module ‘Wat’ does not export ‘distinct’
  |
3 | import Wat (distinct)
  |             ^^^^^^^^

import Wat and import Wat (Record(distinct)) compile without errors in both 8.4.4 and 8.6.4.

Edited by Thor Adam
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information