summaryrefslogtreecommitdiff
path: root/applicative/h11.hs
diff options
context:
space:
mode:
Diffstat (limited to 'applicative/h11.hs')
-rw-r--r--applicative/h11.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/applicative/h11.hs b/applicative/h11.hs
new file mode 100644
index 0000000..54eb02d
--- /dev/null
+++ b/applicative/h11.hs
@@ -0,0 +1,6 @@
+-- http://stackoverflow.com/questions/23316255/lax-monoidal-functors-with-a-different-monoidal-structure
+pure a = fmap (const a) unit
+unit = pure ()
+
+ff <*> fa = fmap (\(f,a) -> f a) $ ff ** fa
+fa ** fb = pure (,) <*> fa <*> fb