summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-04-06 19:37:51 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-04-06 19:37:51 +0800
commit3cf3e36b1498271f3c9162576809d886482e6d97 (patch)
tree783fb036751d95b0b5fe2e4cb21d45a5dc2660e9
parent36a645180f3ef13126c06b957d76c729f62d41fd (diff)
downloadtypeclass-3cf3e36b1498271f3c9162576809d886482e6d97.tar.gz
typeclass-3cf3e36b1498271f3c9162576809d886482e6d97.tar.bz2
typeclass-3cf3e36b1498271f3c9162576809d886482e6d97.zip
11
-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