[project @ 1998-02-03 11:24:18 by simonm]
[ghc-hetmet.git] / ghc / tests / deSugar / should_compile / ds035.hs
1 module ShouldCompile where
2
3 import GlaExts
4
5 data CList = CNil | CCons Int# CList
6
7 mk :: Int# -> CList
8 mk n = case (n ==# 0#) of
9        False -> CNil
10        _     -> CCons 1# (mk (n -# 1#))
11
12 clen :: CList -> Int#
13 clen CNil = 0#
14 clen (CCons _ cl) = 1# +# (clen cl)
15
16 main = putStr (case len4_twice of
17             8# -> "bingo\n"
18             _  -> "oops\n")
19   where
20     list4       = mk 4#
21     len4        = clen list4
22     len4_twice  = len4 +# len4