From f9bef527a697fbcf1e142789c7344f84d8cfa289 Mon Sep 17 00:00:00 2001 From: Tomasz Rybarczyk Date: Thu, 12 May 2016 19:39:38 +0200 Subject: [PATCH] Add Show instance --- src/Data/These.purs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Data/These.purs b/src/Data/These.purs index c44ef45..6967483 100644 --- a/src/Data/These.purs +++ b/src/Data/These.purs @@ -20,6 +20,8 @@ import Prelude , Functor , Monad , Semigroup + , Show + , show , pure , id ) @@ -94,6 +96,11 @@ instance bindThese :: (Semigroup a) => Bind (These a) where instance monadThese :: (Semigroup a) => Monad (These a) +instance showThese :: (Show a, Show b) => Show (These a b) where + show (This x) = "This (" <> show x <> ")" + show (That y) = "That (" <> show y <> ")" + show (Both x y) = "Both (" <> show x <> ") (" <> show y <> ")" + these :: forall a b c. (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c these l _ _ (This a) = l a these _ r _ (That x) = r x