我不明白为什么我使用thyme
库遇到此错误:
λ import qualified Data.Thyme.Format as ABC (formatTime)
λ import qualified Data.Thyme.Clock as XYZ
λ import Data.Thyme.Time.Core (fromThyme)
λ let test123 :: XYZ.UTCView -> String; test123 p = ABC.formatTime defaultTimeLocale "%Y-%m-%d" (fromThyme p :: XYZ.UTCTime)
<interactive>:4:96: error:
• Couldn't match type ‘time-1.8.0.2:Data.Time.Clock.Internal.UTCTime.UTCTime’
with ‘XYZ.UTCTime’
NB: ‘XYZ.UTCTime’
is defined in ‘Data.Thyme.Clock.Internal’
in package ‘thyme-0.3.5.5’
‘time-1.8.0.2:Data.Time.Clock.Internal.UTCTime.UTCTime’
is defined in ‘Data.Time.Clock.Internal.UTCTime’
in package ‘time-1.8.0.2’
arising from a functional dependency between:
constraint ‘Data.Thyme.Time.Core.Thyme XYZ.UTCTime XYZ.UTCView’
arising from a use of ‘fromThyme’
instance ‘Data.Thyme.Time.Core.Thyme
time-1.8.0.2:Data.Time.Clock.Internal.UTCTime.UTCTime XYZ.UTCView’
at <no location info>
• In the third argument of ‘formatTime’, namely
‘(fromThyme p :: XYZ.UTCTime)’
In the expression:
formatTime
defaultTimeLocale "%Y-%m-%d" (fromThyme p :: XYZ.UTCTime)
In an equation for ‘test123’:
test123 p
= formatTime
defaultTimeLocale "%Y-%m-%d" (fromThyme p :: XYZ.UTCTime)
为什么引用time
库中定义的UTCTime?
http://hackage.haskell.org/package/thyme-0.3.5.5/docs/Data-Thyme-Format.html#t:FormatTime
答案 0 :(得分:1)