summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T18013.hs
blob: 08b0a057d2a57f342dfb7fa0883ba2d94baf08bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# OPTIONS_GHC -ddump-rule-firings -ddump-simpl
                -dsuppress-coercions -dsuppress-uniques #-}
{-# LANGUAGE Arrows #-}

module T18013 where

import Control.Arrow
import T18013a

-- We want to ensure this generates good code. Uses of (.) should be
-- specialized and inlined, and the rules defined on mkRule should fire.

mapMaybeRule :: Rule IO a b -> Rule IO (Maybe a) (Maybe b)
mapMaybeRule f = proc v -> case v of
  Just x -> do
    y <- f -< x
    returnA -< Just y
  Nothing -> returnA -< Nothing