Add trace

This commit is contained in:
Mats Rauhala 2021-11-03 13:17:09 +02:00
parent 8b2181563a
commit 723ce8ef9f
2 changed files with 11 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
dist-newstyle
.envrc

9
src/Trace.hs Normal file
View File

@ -0,0 +1,9 @@
{-# LANGUAGE DerivingVia #-}
module Trace where
import Data.Functor.Contravariant (Op(..), Contravariant)
import Data.Monoid (Ap(..))
newtype Trace m a = Trace { trace :: a -> m () }
deriving Contravariant via Op (m ())
deriving (Semigroup, Monoid) via Op (Ap m ()) a