summaryrefslogtreecommitdiff
path: root/testsuite/tests/profiling/should_run/callstack002.hs
blob: 437e2cb3d98182c41a112c13470ecd9f3a0615d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE BangPatterns #-}
module Main where

import Debug.Trace
import Text.Printf
import Prelude hiding (map)
import GHC.Stack

f :: Int -> Int
f x = traceStack (printf "f: %d" x) (x * 2)

map :: (a -> b) -> [a] -> [b]
map f xs = go xs
  where go [] = []
        go (x:xs) = f x : map f xs

main = do
  let xs = map f [42,43]
  print xs
  putStrLn =<< renderStack `fmap` (whoCreated $! head xs)