Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement