Я пытаюсь использовать экземпляр UTCTime CalendarTimeConvertible, найденный в библиотеке time-recurrence .Он указан в документации, но когда я импортирую библиотеку в ghci и оцениваю i: CalendarTimeConvertible
, экземпляр не появляется.
class CalendarTimeConvertible t where
toCalendarTime :: t -> CalendarTime
fromCalendarTime :: CalendarTime -> Maybe t
-- Defined in ‘time-recurrence-0.9.3:Data.Time.CalendarTime.CalendarTime’
instance CalendarTimeConvertible CalendarTime
-- Defined in ‘time-recurrence-0.9.3:Data.Time.CalendarTime.CalendarTime’
И при выводе в i: UTCTime
не отображается.1008 *
data UTCTime = UTCTime {utctDay :: Day, utctDayTime :: DiffTime}
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Eq UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Ord UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Read UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Format.Parse’
instance Show UTCTime
-- Defined in ‘time-1.9.1:Data.Time.LocalTime.Internal.ZonedTime’
instance ParseTime UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Format.Parse.Instances’
instance FormatTime UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Format.Format.Instances’
Я не могу понять это.Я пропускаю шаг импорта?Я искал способы явного импорта экземпляров классов типов, но оказался пустым.
Редактировать: Вот мой сеанс:
λ> import Data.Time.Clock
λ> :i UTCTime
data UTCTime
= UTCTime {utctDay :: time-1.9.1:Data.Time.Calendar.Days.Day,
utctDayTime :: DiffTime}
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Eq UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Ord UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Read UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Format.Parse’
instance Show UTCTime
-- Defined in ‘time-1.9.1:Data.Time.LocalTime.Internal.ZonedTime’
λ> import Data.Time.CalendarTime
λ> :i CalendarTimeConvertible
class CalendarTimeConvertible t where
toCalendarTime :: t -> CalendarTime
fromCalendarTime :: CalendarTime -> Maybe t
-- Defined in ‘time-recurrence-0.9.3:Data.Time.CalendarTime.CalendarTime’
instance CalendarTimeConvertible CalendarTime
-- Defined in ‘time-recurrence-0.9.3:Data.Time.CalendarTime.CalendarTime’
λ> :i UTCTime
data UTCTime
= UTCTime {utctDay :: time-1.9.1:Data.Time.Calendar.Days.Day,
utctDayTime :: DiffTime}
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Eq UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Ord UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Clock.Internal.UTCTime’
instance Read UTCTime
-- Defined in ‘time-1.9.1:Data.Time.Format.Parse’
instance Show UTCTime
-- Defined in ‘time-1.9.1:Data.Time.LocalTime.Internal.ZonedTime’
λ>