summaryrefslogtreecommitdiff
path: root/testsuite/tests/mdo/should_fail/mdofail004.hs
blob: 37cd757312233380eb41bd10902218fae8059b28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# OPTIONS -XRecursiveDo #-}

-- OLD: mdo requires MonadFix instance, even
--      if no recursion is present

-- Dec 2010: Small change of behaviour
--     MonadFix is only required if recursion is present

module Main (main) where

import Control.Monad.Fix

data X a = X a deriving Show

instance Monad X where
  return      = X
  (X a) >>= f = f a

z :: X [Int]
z = mdo { a <- return 1; return [a] }

main = print z