summaryrefslogtreecommitdiffhomepage
path: root/Types.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2018-12-08 13:26:14 -0400
committerJoey Hess <joeyh@joeyh.name>2018-12-08 13:28:42 -0400
commit9d7e697474720b2c6e78fbf11066a8499fc55807 (patch)
treef2f1b6b0c29017f2fcc6cb206ffea5939d3b19c7 /Types.hs
parentad33cd0f276eb898db5287dd36bf06fd6258f911 (diff)
downloaddebug-me-9d7e697474720b2c6e78fbf11066a8499fc55807.tar.gz
Update to lts-12.10, support ghc 8.4, and aeson 1.3.
Don't fully understand the need for the MonoLocalBinds language extension, which was not needed before but now ghc complains if it's not included, but I've tested it and it does work. All the rest of the changes are straightforward AMP changes and dep updates. Removed fgl from stack.yaml because it seems that indirect dep no longer needs to be specified for stack to build. Added custom-setup stanza since stack now warns without one. This commit was sponsored by Trenton Cronholm on Patreon.
Diffstat (limited to 'Types.hs')
-rw-r--r--Types.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Types.hs b/Types.hs
index ce986c7..bbf296f 100644
--- a/Types.hs
+++ b/Types.hs
@@ -22,6 +22,7 @@ import JSON
import qualified Data.Text as T
import Data.Time.Clock.POSIX
+import qualified Data.Semigroup as Sem
-- | Things that the developer sees.
data Seen = Seen
@@ -194,9 +195,12 @@ newtype ElapsedTime = ElapsedTime Double
mkElapsedTime :: POSIXTime -> POSIXTime -> ElapsedTime
mkElapsedTime start end = ElapsedTime $ fromRational $ toRational (end - start)
+instance Sem.Semigroup ElapsedTime where
+ ElapsedTime a <> ElapsedTime b = ElapsedTime (a+b)
+
instance Monoid ElapsedTime where
mempty = ElapsedTime 0
- mappend (ElapsedTime a) (ElapsedTime b) = ElapsedTime (a+b)
+ mappend = (Sem.<>)
instance DataSize ElapsedTime where
dataSize _ = 16 -- 128 bit Double