diff --git a/test/functional/Tactic.hs b/test/functional/Tactic.hs index 6e33a96a90..d46dc8ff29 100644 --- a/test/functional/Tactic.hs +++ b/test/functional/Tactic.hs @@ -117,6 +117,9 @@ tests = testGroup , expectFail "GoldenFish.hs" 5 18 Auto "" , goldenTest "GoldenArbitrary.hs" 25 13 Auto "" , goldenTest "FmapBoth.hs" 2 12 Auto "" + , goldenTest "FmapJoin.hs" 2 14 Auto "" + , goldenTest "Fgmap.hs" 2 9 Auto "" + , goldenTest "FmapJoinInLet.hs" 4 19 Auto "" ] diff --git a/test/testdata/tactic/Fgmap.hs b/test/testdata/tactic/Fgmap.hs new file mode 100644 index 0000000000..de1968474e --- /dev/null +++ b/test/testdata/tactic/Fgmap.hs @@ -0,0 +1,2 @@ +fgmap :: (Functor f, Functor g) => (a -> b) -> (f (g a) -> f (g b)) +fgmap = _ diff --git a/test/testdata/tactic/Fgmap.hs.expected b/test/testdata/tactic/Fgmap.hs.expected new file mode 100644 index 0000000000..98345b23c9 --- /dev/null +++ b/test/testdata/tactic/Fgmap.hs.expected @@ -0,0 +1,2 @@ +fgmap :: (Functor f, Functor g) => (a -> b) -> (f (g a) -> f (g b)) +fgmap = (\ fab fga -> fmap (\ a -> fmap fab a) fga) diff --git a/test/testdata/tactic/FmapJoin.hs b/test/testdata/tactic/FmapJoin.hs new file mode 100644 index 0000000000..98a40133ea --- /dev/null +++ b/test/testdata/tactic/FmapJoin.hs @@ -0,0 +1,2 @@ +fJoin :: (Monad m, Monad f) => f (m (m a)) -> f (m a) +fJoin = fmap _ diff --git a/test/testdata/tactic/FmapJoin.hs.expected b/test/testdata/tactic/FmapJoin.hs.expected new file mode 100644 index 0000000000..733e090b72 --- /dev/null +++ b/test/testdata/tactic/FmapJoin.hs.expected @@ -0,0 +1,2 @@ +fJoin :: (Monad m, Monad f) => f (m (m a)) -> f (m a) +fJoin = fmap (\ mma -> (>>=) mma (\ ma -> ma)) diff --git a/test/testdata/tactic/FmapJoinInLet.hs b/test/testdata/tactic/FmapJoinInLet.hs new file mode 100644 index 0000000000..e6fe6cbd0d --- /dev/null +++ b/test/testdata/tactic/FmapJoinInLet.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE ScopedTypeVariables #-} + +fJoin :: forall f m a. (Monad m, Monad f) => f (m (m a)) -> f (m a) +fJoin = let f = (_ :: m (m a) -> m a) in fmap f diff --git a/test/testdata/tactic/FmapJoinInLet.hs.expected b/test/testdata/tactic/FmapJoinInLet.hs.expected new file mode 100644 index 0000000000..b8bf0cdd07 --- /dev/null +++ b/test/testdata/tactic/FmapJoinInLet.hs.expected @@ -0,0 +1,4 @@ +{-# LANGUAGE ScopedTypeVariables #-} + +fJoin :: forall f m a. (Monad m, Monad f) => f (m (m a)) -> f (m a) +fJoin = let f = ( (\ mma -> (>>=) mma (\ ma -> ma)) :: m (m a) -> m a) in fmap f