Skip to content

Commit

Permalink
Fixed Product comonad snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszMilewski committed Jun 13, 2019
1 parent 15c672c commit 23f522e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/content/3.7/code/haskell/snippet08.hs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
data Product e a = P e a deriving Functor
data Product e a = Prod e a deriving Functor
4 changes: 2 additions & 2 deletions src/content/3.7/code/haskell/snippet09.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(=>=) :: (Product e a -> b) -> (Product e b -> c) -> (Product e a -> c)
f =>= g = \(P e a) -> let b = f (P e a)
c = g (P e b)
f =>= g = \(Prod e a) -> let b = f (Prod e a)
c = g (Prod e b)
in c
2 changes: 1 addition & 1 deletion src/content/3.7/code/haskell/snippet10.hs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
extract (P e a) = a
extract (Prod e a) = a
2 changes: 1 addition & 1 deletion src/content/3.7/code/haskell/snippet32.hs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
counit (Product (Reader f, s)) = f s
counit (Prod (Reader f) s)) = f s
3 changes: 2 additions & 1 deletion src/content/3.7/code/haskell/snippet34.hs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
unit a = Reader (\s -> Product (a, s))
unit :: a -> Reader s (Product a s)
unit a = Reader (\s -> Prod a s)

0 comments on commit 23f522e

Please sign in to comment.