summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T18078.hs
blob: e28b4a98acf487b94b1724e656ebed3efbe17fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module T18078 where

newtype N = N { unN :: Int -> Int }

-- This an example of a worker/wrapper thing
-- See Note [Cast worker/wrappers] in Simplify
-- We should get good code, with a $wf calling itself
-- but in 8.10 we do not
f :: N
{-# NOINLINE f #-}
f = N (\n -> if n==0 then 0 else unN f (n-1))

g x = unN f (x+1)