summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/T2722.hs
blob: 3912c840e7f3ce25566057874ecf89422cf34cf0 (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
31
32
33
34
module Main (main, arid1, arid2) where

import Prelude hiding (id, (.))
import qualified Prelude
import Control.Category
import Control.Arrow
import System.IO
import Debug.Trace


main = do { xs <- runXIOState arid1        -- Works with arid2
          ; print xs }

runXIOState :: IOSLA () c -> IO [c]
runXIOState f = runIOSLA f ()

newtype IOSLA a b = IOSLA { runIOSLA :: a -> IO [b] }

instance Arrow IOSLA where
    arr f = IOSLA $ \ x -> return [f x]

instance Category IOSLA where
    id = arr id

-- arr :: Arrow m => (b->c) -> m b c
-- id  :: Category m => m b b
-- (arr id) :: Arrow m => m a a

arid1 :: Arrow m => m a a
arid1 = arr id

arid2 :: Arrow m => m a a
arid2 = arr Prelude.id