Created
October 3, 2020 11:40
-
-
Save Icelandjack/3ba65595f6ec78b5c4ff28df745f4caf to your computer and use it in GitHub Desktop.
Tree instance for Ap and Biap
This file contains hidden or 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 (Applicative f, Treey tree) => Treey (Ap f tree) where | |
leaf :: Int -> Ap f tree | |
leaf = pure . leaf | |
(¦) :: Ap f tree -> Ap f tree -> Ap f tree | |
(¦) = liftA2 (¦) | |
instance (Biapplicative bi, Treey tree1, Treey tree2) => Treey (Biap bi tree1 tree2) where | |
leaf :: Int -> Biap bi tree1 tree2 | |
leaf = liftA2 bipure leaf leaf | |
(¦) :: Biap bi tree1 tree2 -> Biap bi tree1 tree2 -> Biap bi tree1 tree2 | |
(¦) = biliftA2 (¦) (¦) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment