summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/perf/space_leaks/T2762A.hs
blob: 665fa6ef72154c30153bcd111e98bff317bbc185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

module T2762A (input) where

class InputOutput a where
    input :: String -> (a, String)

instance InputOutput Char where
    input (x : bs) = (x, bs)

instance InputOutput a => InputOutput [a] where
    input ('0':bs) = ([], bs)
    input ('1':bs) = case input bs of
                     (x, bs') ->
                         case input bs' of
                         ~(xs, bs'') -> (x : xs, bs'')