Skip to content

Instantly share code, notes, and snippets.

@sshine

sshine/do.hs Secret

Last active September 14, 2021 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshine/4883017fd5969d5962c1782a562f8818 to your computer and use it in GitHub Desktop.
Save sshine/4883017fd5969d5962c1782a562f8818 to your computer and use it in GitHub Desktop.
newtype TEST a = TEST { runTEST :: Int -> Double -> Either String (a, String, Double) }
instance Monad TEST where
m >>= f = TEST $ \i db0 -> do
(a,ch,db1) <- runTEST m i db0
(a',ch',db2) <- runTEST (f a) rd db1
return (a',ch ++ ch',db2)
instance Monad TEST where
m >>= f = TEST $ \i db0 ->
runTEST m i db0 >>= \(a,ch,db1) ->
runTEST (f a) rd db1 >>= \(a',ch',db2) ->
return (a',ch ++ ch',db2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment