Skip to content

Commit 93ed81a

Browse files
authored
Update maybe3.hs
Add more usefull example
1 parent 598f22c commit 93ed81a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Haskell/maybe3.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ instance Applicative Maybe where
1616
Nothing <*> _ = Nothing
1717

1818
main = do
19-
let a = Just 5
20-
b = Just $ (* 2) . (+ 5) . (^ 2)
21-
c = b <*> a
22-
print c
19+
print $ (*) <$> Nothing <*> Nothing
20+
print $ (*) <$> Nothing <*> Just 2
21+
print $ (*) <$> Just 3 <*> Nothing
22+
print $ (*) <$> Just 3 <*> Just 2

0 commit comments

Comments
 (0)