From daf3c2255a2aa7661937648e2f42fd1e8f64f8df Mon Sep 17 00:00:00 2001 From: Geoffrey Mainland Date: Thu, 2 Oct 2014 17:39:34 -0400 Subject: Make Applicative-Monad fixes for tests. --- testsuite/tests/array/should_run/arr016.hs | 10 +++++++--- testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs | 2 +- testsuite/tests/codeGen/should_run/cgrun068.hs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/array/should_run/arr016.hs b/testsuite/tests/array/should_run/arr016.hs index 055e6602be..0e8e2bfe2e 100644 --- a/testsuite/tests/array/should_run/arr016.hs +++ b/testsuite/tests/array/should_run/arr016.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE ScopedTypeVariables, DatatypeContexts #-} +{-# LANGUAGE ScopedTypeVariables #-} module Main where @@ -151,7 +151,7 @@ instance Show (a -> b) where { show _ = "" } ------------------------------------------------------------------------------ -data (Ix a) => Array a b = MkArray (a,a) (a -> b) deriving () +data Array a b = MkArray (a,a) (a -> b) deriving () array :: (Ix a) => (a,a) -> [(a,b)] -> Array a b array b ivs = @@ -259,6 +259,10 @@ generate n rnd (Gen m) = m size rnd' instance Functor Gen where fmap f m = m >>= return . f +instance Applicative Gen where + pure = return + (<*>) = liftM2 id + instance Monad Gen where return a = Gen (\n r -> a) Gen m >>= k = @@ -508,4 +512,4 @@ instance Observable StdGen where { observer = observeBase } instance Observable a => Observable (Gen a) where observer (Gen a) = send "Gen" (return (Gen) << a) --} \ No newline at end of file +-} diff --git a/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs b/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs index 7243fadb06..05a84df210 100644 --- a/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs +++ b/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs @@ -361,7 +361,7 @@ cloneMArraySlow !marr !off n = -- Utilities for simplifying RNG passing newtype Rng s a = Rng { unRng :: StateT StdGen (ST s) a } - deriving Monad + deriving (Functor, Applicative, Monad) -- Same as 'randomR', but using the RNG state kept in the 'Rng' monad. rnd :: Random a => (a, a) -> Rng s a diff --git a/testsuite/tests/codeGen/should_run/cgrun068.hs b/testsuite/tests/codeGen/should_run/cgrun068.hs index 69a8b279f8..00d1249eaa 100644 --- a/testsuite/tests/codeGen/should_run/cgrun068.hs +++ b/testsuite/tests/codeGen/should_run/cgrun068.hs @@ -361,7 +361,7 @@ cloneMArraySlow !marr !off n = -- Utilities for simplifying RNG passing newtype Rng s a = Rng { unRng :: StateT StdGen (ST s) a } - deriving Monad + deriving (Functor, Applicative, Monad) -- Same as 'randomR', but using the RNG state kept in the 'Rng' monad. rnd :: Random a => (a, a) -> Rng s a -- cgit v1.2.1