summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/T12791.hs
blob: 94ebee77baf007ddcc096ba5ce02ae38b9d397b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-}
module Main ( main ) where

class Foldable f => C f a where
  m :: f a -> a

instance C [] Int where
  m = foldr (+) 0

{-# NOINLINE go #-}
go :: C [] b => b -> Int -> Int
go _ i = foldr (+) 0 [1..i]

main :: IO ()
main = print $ go (0 :: Int) 20000