summaryrefslogtreecommitdiff
path: root/testsuite/tests/ado/T12490.hs
blob: e1bb022990a531f9ea190c129cb34f6677593d26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE ApplicativeDo #-}

module T12490 where

import Prelude (Int, String, Functor(..), ($), undefined, (+))

join :: Monad f => f (f a) -> f a
join = undefined

class Functor f => Applicative f where
    pure :: a -> f a
    (<*>) :: f (a -> b) -> f a -> f b

class Applicative f => Monad f where
    return :: a -> f a
    (>>=) :: f a -> (a -> f b) -> f b
    fail :: String -> f a

f_app :: Applicative f => f Int -> f Int -> f Int
f_app a b = do
    a' <- a
    b' <- b
    pure (a' + b')

f_monad :: Monad f => f Int -> f Int -> f Int
f_monad a b = do
    a' <- a
    b' <- b
    return $ a' + b'