summaryrefslogtreecommitdiff
path: root/testsuite/tests/arrows/should_compile/T5283.hs
blob: 9216d3cd679a8374cd4c9e12b41f2f09398e2a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE Arrows #-}
-- Failed in ghci

module T where

import Prelude
import Control.Arrow

mapAC :: Arrow arr => Integer -> arr (env, b) c -> arr (env, [b]) [c]  
mapAC n farr = go 1
  where
    go i | i == succ n = arr (\(_env, []) -> [])
         | otherwise = proc ~(env, b : bs) ->
             do c  <- farr -< (env, b)
                cs <- go (succ i) -< (env, bs)
                returnA -< c : cs

t :: Arrow arr => arr [a] [a]
t = proc ys ->
     (| (mapAC 3) (\y -> returnA -< y) |) ys