Reputation: 34021
I don't understand why I am getting this error using the thyme
library:
λ 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)
Why is it referencing the UTCTime defined within the time
library?
http://hackage.haskell.org/package/thyme-0.3.5.5/docs/Data-Thyme-Format.html#t:FormatTime
Upvotes: 1
Views: 82
Reputation: 153172
Because:
fromThyme :: Thyme b a => a -> b
instance Thyme Data.Time.Clock.UTCTime UTCView
You should probably use utcTime
instead.
Upvotes: 1