[Haskell-cafe] RebindableSyntax Strangeness
Henry Laxen
nadine.and.henry at pobox.com
Mon Aug 31 14:12:31 UTC 2020
Hi Cafe,
I have encountered the following puzzling behaviour from a very simple
program:
Consider
-- {-# LANGUAGE RebindableSyntax #-}
module A where
import Data.Time
running this with ghci gives:
A> :i UTCTime
type UTCTime :: *
data UTCTime = UTCTime {utctDay :: Day, utctDayTime :: DiffTime}
-- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Eq UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Ord UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] Show UTCTime
-- Defined in ‘time-1.9.3:Data.Time.LocalTime.Internal.ZonedTime’
instance [safe] FormatTime UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Format.Format.Instances’
instance [safe] Read UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Format.Parse’
instance [safe] ParseTime UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Format.Parse.Instances’
Now uncomment the first line (RebindableSyntax) and rerun it:
A> :i UTCTime
type UTCTime :: *
data UTCTime = UTCTime {utctDay :: Day, utctDayTime :: DiffTime}
-- Defined in ‘time-1.9.3:Data.Time.Clock.Internal.UTCTime’
instance [safe] FormatTime UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Format.Format.Instances’
instance [safe] ParseTime UTCTime
-- Defined in ‘time-1.9.3:Data.Time.Format.Parse.Instances’
And all of the nice instances for UTCTime have disappeared. Why?
Best wishes,
Henry Laxen
More information about the Haskell-Cafe
mailing list