0 | module Data.Linear.LEither
2 | import Data.Linear.Bifunctor
3 | import Data.Linear.Interface
4 | import Data.Linear.Notation
9 | data LEither : (a, b : Type) -> Type where
10 | Left : a -@ LEither a b
11 | Right : b -@ LEither a b
14 | (Consumable a, Consumable b) => Consumable (LEither a b) where
15 | consume (Left a) = consume a
16 | consume (Right b) = consume b
19 | (Duplicable a, Duplicable b) => Duplicable (LEither a b) where
20 | duplicate (Left a) = Left <$> duplicate a
21 | duplicate (Right b) = Right <$> duplicate b