[Haskell-cafe] RebindableSyntax Strangeness
Li-yao Xia
lysxia at gmail.com
Mon Aug 31 14:23:44 UTC 2020
Hi Henry,
RebindableSyntax implies NoImplicitPrelude, which puts Eq, Ord, Show,
and Read out of scope.
Cheers,
Li-yao
On 8/31/2020 10:12 AM, Henry Laxen wrote:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
More information about the Haskell-Cafe
mailing list