summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2013-09-08 09:02:04 -0500
committerAustin Seipp <aseipp@pobox.com>2013-09-08 09:30:10 -0500
commit0b1bea4360d730ae4c91092bc94bc541631dbc84 (patch)
treed87feed052483dccadd73a158ec386955be25707 /testsuite/tests/gadt
parent8859e1e3e4e6c695a4e9a1659fc0ec935141324a (diff)
downloadhaskell-0b1bea4360d730ae4c91092bc94bc541631dbc84.tar.gz
Fix most AMP warnings.
Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <aseipp@pobox.com>
Diffstat (limited to 'testsuite/tests/gadt')
-rw-r--r--testsuite/tests/gadt/gadt16.hs10
-rw-r--r--testsuite/tests/gadt/nbe.hs10
2 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/gadt16.hs b/testsuite/tests/gadt/gadt16.hs
index 133c833903..194ed5d6ea 100644
--- a/testsuite/tests/gadt/gadt16.hs
+++ b/testsuite/tests/gadt/gadt16.hs
@@ -14,6 +14,9 @@
module Sample where
+import Control.Applicative (Applicative(..))
+import Control.Monad (liftM, ap)
+
data Safe
data MayFail
@@ -23,6 +26,13 @@ data Result s a where
newtype M s a = M { unM :: IO (Result s a) }
+instance Functor (M s) where
+ fmap = liftM
+
+instance Applicative (M s) where
+ pure = return
+ (<*>) = ap
+
instance Monad (M s) where
return x = M (return (Ok x))
diff --git a/testsuite/tests/gadt/nbe.hs b/testsuite/tests/gadt/nbe.hs
index 82b7b83259..60141291fc 100644
--- a/testsuite/tests/gadt/nbe.hs
+++ b/testsuite/tests/gadt/nbe.hs
@@ -2,6 +2,9 @@
module Main where
+import Control.Applicative (Applicative(..))
+import Control.Monad (liftM, ap)
+
-- abstract syntax -------------------------------------------------------------
data Ty t where
Bool :: Ty Bool
@@ -87,6 +90,13 @@ data Tree a = Val a | Choice (Tree a) (Tree a)
-- Val :: a -> Tree a Z
-- Choice :: Tree a n -> Tree a n -> Tree a (S n)
+instance Functor Tree where
+ fmap = liftM
+
+instance Applicative Tree where
+ pure = return
+ (<*>) = ap
+
instance Monad Tree where
return x = Val x
(Val a) >>= f = f a