Skip to content

Commit

Permalink
Move bimapPair' to Prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-volkov committed Aug 26, 2021
1 parent 684c0b2 commit 18c9745
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions library/ListT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ instance Monad m => Monoid (ListT m a) where
return Nothing
mappend = (<>)

-- A slightly stricter version of Data.Bifunctor.bimap.
-- There's no benefit to producing lazy pairs here.
bimapPair' :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
bimapPair' f g = \(a,c) -> (f a, g c)

instance Functor m => Functor (ListT m) where
fmap f = go
where
Expand Down
7 changes: 7 additions & 0 deletions library/ListT/Prelude.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module ListT.Prelude
(
module Exports,
bimapPair',
)
where

Expand Down Expand Up @@ -77,3 +78,9 @@ import Text.ParserCombinators.ReadPrec as Exports (ReadPrec, readPrec_to_P, read
import Text.Printf as Exports (printf, hPrintf)
import Text.Read as Exports (Read(..), readMaybe, readEither)
import Unsafe.Coerce as Exports

-- |
-- A slightly stricter version of Data.Bifunctor.bimap.
-- There's no benefit to producing lazy pairs here.
bimapPair' :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
bimapPair' f g = \(a,c) -> (f a, g c)

0 comments on commit 18c9745

Please sign in to comment.