summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T10715.hs
blob: a3d5d261c9c9aec0363c8264751efd7f20d5d8de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE FlexibleContexts #-}
module T10715 where

import Data.Coerce (coerce, Coercible)
import Data.Ord ( Down )  -- convenient newtype

data X a

-- See #10715 for a long discussion about whether
-- this should be accepted or not.
--
-- But in #12466 we decided to accept contradictory
-- type signatures, so definition is now accepeted even
-- though you can never call it.  Instead we get a
-- redundant pattern-match warning, in the
-- post-typechecking pattern-match checks
doCoerce :: Coercible a (X a) => a -> X a
doCoerce = coerce