Skip to content

Commit a82ab44

Browse files
committed
Data.Thyme.Clock: unUTCTime ViewPatterns example
1 parent 25e13a1 commit a82ab44

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Data/Thyme/Clock.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ picosecondsToDiffTime = review picoseconds
140140
-- 'unUTCTime' = 'view' 'utcTime'
141141
-- @
142142
--
143+
-- With @{-# LANGUAGE ViewPatterns #-}@, you can write: e.g.
144+
--
145+
-- @
146+
-- f :: 'UTCTime' -> ('Day', 'DiffTime')
147+
-- f ('unUTCTime' -> 'UTCView' day dt) = (day, dt)
148+
-- @
149+
--
143150
-- For GHC 7.8 or later, there is also the pattern synonym
144151
-- @<Data-Thyme-Clock.html#v:UTCTime UTCTime>@.
145152
{-# INLINE unUTCTime #-}

0 commit comments

Comments
 (0)