Skip to content

Commit

Permalink
Merge pull request #13 from paluh/master
Browse files Browse the repository at this point in the history
Add Show instance
  • Loading branch information
garyb committed May 16, 2016
2 parents 24f9cd2 + f9bef52 commit 96a0c16
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Data/These.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import Prelude
, Functor
, Monad
, Semigroup
, Show
, show
, pure
, id )

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 96a0c16

Please sign in to comment.