Created
July 31, 2018 06:58
-
-
Save Rydgel/894e44ccce8933374a015349c4d8cabf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance Monad f => Applicative (OptionalT f) where | |
pure :: | |
a | |
-> OptionalT f a | |
pure = | |
OptionalT . pure . pure | |
(<*>) :: | |
OptionalT f (a -> b) | |
-> OptionalT f a | |
-> OptionalT f b | |
(OptionalT f) <*> (OptionalT a) = | |
OptionalT (lift2 (<*>) f a) | |
-- (<$>) for OptionalT: OK | |
-- (<*>) for OptionalT | |
-- one: OK | |
-- two: OK | |
-- three: OK | |
-- four: OK | |
-- five: FAIL | |
-- test/Course/StateTTest.hs:133: | |
-- expected: [Empty] | |
-- but got: [Empty,Empty] | |
-- six: FAIL | |
-- test/Course/StateTTest.hs:136: | |
-- expected: [Full 2,Full 3,Empty] | |
-- but got: [Full 2,Full 3,Empty,Empty] | |
-- seven: OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment