Skip to content

Commit 96a0c16

Browse files
committed
Merge pull request #13 from paluh/master
Add Show instance
2 parents 24f9cd2 + f9bef52 commit 96a0c16

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Data/These.purs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import Prelude
2020
, Functor
2121
, Monad
2222
, Semigroup
23+
, Show
24+
, show
2325
, pure
2426
, id )
2527

@@ -94,6 +96,11 @@ instance bindThese :: (Semigroup a) => Bind (These a) where
9496

9597
instance monadThese :: (Semigroup a) => Monad (These a)
9698

99+
instance showThese :: (Show a, Show b) => Show (These a b) where
100+
show (This x) = "This (" <> show x <> ")"
101+
show (That y) = "That (" <> show y <> ")"
102+
show (Both x y) = "Both (" <> show x <> ") (" <> show y <> ")"
103+
97104
these :: forall a b c. (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c
98105
these l _ _ (This a) = l a
99106
these _ r _ (That x) = r x

0 commit comments

Comments
 (0)