summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/T19847.hs
blob: 6187038d026f913fe8333afee99fe9c7ef3e3877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE GADTs, PatternSynonyms, ViewPatterns, ScopedTypeVariables #-}

module T19847 where

import Data.Kind
import Type.Reflection

pattern Is :: forall (b :: Type) (a :: Type). Typeable b => (a ~ b) => TypeRep a
pattern Is <- (eqTypeRep (typeRep @b) -> Just HRefl)
  where Is = typeRep

def :: TypeRep a -> a
def x = case x of
  Is @Int  -> 10
  Is @Bool -> False