blob: b9bd048cbda2cd6f5f73263c4f3a63d7e85b2462 (
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
31
32
33
34
35
36
|
{-# OPTIONS_GHC -Wincomplete-patterns -fforce-recomp #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnliftedNewtypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
module T18249 where
import GHC.Exts
f :: Int# -> Int
-- redundant, not just inaccessible!
f !_ | False = 1
f _ = 2
newtype UVoid :: TYPE 'UnliftedRep where
UVoid :: UVoid -> UVoid
g :: UVoid -> Int
-- redundant in a weird way:
-- there's no way to actually write this function.
-- Inhabitation testing currently doesn't find that UVoid is empty,
-- but we should be able to detect the bang as redundant.
g !_ = 1
h :: (# (), () #) -> Int
-- redundant, not just inaccessible!
h (# _, _ #) | False = 1
h _ = 2
i :: Int -> Int
i !_ | False = 1
i (I# !_) | False = 2
i _ = 3
|