summaryrefslogtreecommitdiff
path: root/testsuite/tests/determinism/determ017/A.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/determinism/determ017/A.hs')
-rw-r--r--testsuite/tests/determinism/determ017/A.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/testsuite/tests/determinism/determ017/A.hs b/testsuite/tests/determinism/determ017/A.hs
index 5e3c3d0809..082c9380de 100644
--- a/testsuite/tests/determinism/determ017/A.hs
+++ b/testsuite/tests/determinism/determ017/A.hs
@@ -20,7 +20,7 @@
-- | Module "Trampoline" defines the pipe computations and their basic building blocks.
{-# LANGUAGE ScopedTypeVariables, Rank2Types, MultiParamTypeClasses,
- TypeFamilies, KindSignatures, FlexibleContexts, NoMonadFailDesugaring,
+ TypeFamilies, KindSignatures, FlexibleContexts,
FlexibleInstances, OverlappingInstances, UndecidableInstances
#-}
@@ -81,6 +81,9 @@ instance Monad Identity where
return a = Identity a
m >>= k = k (runIdentity m)
+instance MonadFail Identity where
+ fail = error "Identity(fail)"
+
newtype Trampoline m s r = Trampoline {bounce :: m (TrampolineState m s r)}
data TrampolineState m s r = Done r | Suspend! (s (Trampoline m s r))
@@ -97,6 +100,9 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where
where apply f (Done x) = bounce (f x)
apply f (Suspend s) = return (Suspend (fmap (>>= f) s))
+instance (MonadFail m, Functor s) => MonadFail (Trampoline m s) where
+ fail = error "Trampoline(fail)"
+
data Yield x y = Yield! x y
instance Functor (Yield x) where
fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y)