Skip to content

Instantly share code, notes, and snippets.

@Icelandjack
Created Oct 3, 2020
Embed
What would you like to do?
Tree instance for Ap and Biap
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