Skip to content

Instantly share code, notes, and snippets.

@tokiwoousaka
Last active August 29, 2015 14:02
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 tokiwoousaka/df38d322951516c76d2f to your computer and use it in GitHub Desktop.
Save tokiwoousaka/df38d322951516c76d2f to your computer and use it in GitHub Desktop.
import Control.Applicative
data A
data B
data C
data D
data X
f :: A -> B -> C
f = undefined
g :: A -> B -> C -> D
g = undefined
a :: X -> A
a = undefined
b :: X -> B
b = undefined
c :: X -> C
c = undefined
-- x1 =~ y1
x1 :: X -> C
x1 = f <$> a <*> b
y1 :: X -> C
y1 x = f (a x) (b x)
-- x2 =~ y2
x2 :: X -> D
x2 = g <$> a <*> b <*> c
y2 :: X -> D
y2 x = g (a x) (b x) (c x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment