Skip to content

Instantly share code, notes, and snippets.

@kindaro
Last active May 30, 2022 22:04
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 kindaro/344107a20ff340fa1dbdc07fb7d28633 to your computer and use it in GitHub Desktop.
Save kindaro/344107a20ff340fa1dbdc07fb7d28633 to your computer and use it in GitHub Desktop.
{-# language UnicodeSyntax #-}
import Data.Functor
import Control.Monad
f₁ = (putStrLn "f₁" $>)
f₂ = (putStrLn "f₂" $>)
g₁ = (putStrLn "g₁" $>)
g₂ = (putStrLn "g₂" $>)
main = do
r₁ ← (f₁ ⊗ g₁ >=> f₂ ⊗ g₂) (True, False)
print r₁
r₂ ← ((f₁ >=> f₂) ⊗ (g₁ >=> g₂)) (True, False)
print r₂
f ⊗ g = \ (x, y) → do
x' ← f x
y' ← g y
pure (x', y')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment