summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_run/T5587.hs
blob: 4909154dab44a71d6139be2653cb42081cec47b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# OPTIONS_GHC -fpedantic-bottoms #-}
-- The pedantic-bottom flag makes GHC pickier about bottoms
-- See the ticket #5587

module Main(main) where

hiddenError = error "hidden error"

main = print $ seq (head (map (\a -> \b -> hiddenError) (hiddenError::[] Bool))) id [1]

{-  See notes in Trac #5587
f a b =  a
he = hiddenError::[Bool]
main = print $ seq (head (map f he)) id [1]


head (map f he)
= head (build (\cn. foldr (mapFB c f) n he))
= (\cn. foldr (mapFB c f) n he) (\x _ -> x) badHead
= foldr (mapFB (\x _ -> x) f) badHead he
= let go [] = badHead
       go (y:ys) = mapFB (\x _ -> x) f y (go ys)
   in go he
= let go []     = badHead
       go (y:ys) = mapFB (\x _ -> x) f y (go ys)
                 = (\x _. x) (f y) (go ys)
                 = f y
                 = \b. y
   in go he
-}