Created
May 10, 2019 13:10
-
-
Save khibino/1a7acdda1e43074a5cde58ef7e381776 to your computer and use it in GitHub Desktop.
with placeholder example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances #-} | |
import Data.DList | |
import Control.Monad.Trans.Writer (Writer) | |
import Data.Functor.ProductIsomorphic | |
data PH a = PH | |
newtype WithPhT r a = | |
WithPhT { runWithPhT :: Writer (DList Int) (r a) } | |
instance ProductIsoFunctor (WithPhT PH) where | |
_ |$| wx = WithPhT $ runWithPhT wx *> return PH | |
instance ProductIsoApplicative (WithPhT PH) where | |
pureP _ = WithPhT $ return PH | |
wx |*| wy = WithPhT $ runWithPhT wx *> runWithPhT wy *> return PH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment