Untouchable type, pattern synonyms
GHC panicked while experimenting
{-# LANGUAGE PatternSynonyms, ExistentialQuantification, GADTSyntax #-}
module Test where
data Expr a where
Fun :: String -> (a -> b) -> (Expr a -> Expr b)
pattern IntFun :: () => (a ~ Int) => String -> (a -> b) -> (Expr a -> Expr b)
pattern IntFun str f x = Fun str f x
-- Alternative syntax for pattern synonyms:
-- pattern
-- Suc :: () => (a ~ Int) => Expr a -> Expr Int
-- Suc n <- IntFun _ _ n where
-- Suc n = IntFun "suc" (+ 1) n
pattern Suc :: () => (a ~ Int) => Expr a -> Expr Int
pattern Suc n <- IntFun _ _ n where
Suc n = IntFun "suc" (+ 1) n
% ghc Test.hs
[1 of 1] Compiling Test ( Test.hs, Test.o )
Test.hs:12:18:
Couldn't match expected type ‘Int’ with actual type ‘a1’
‘a1’ is untouchable
inside the constraints (a ~ Int)
bound by the type signature for Suc :: Expr a -> Expr Int
at Test.hs:12:9-11ghc: panic! (the 'impossible' happened)
(GHC version 7.10.2 for i386-unknown-linux):
No skolem info: a1_anA[ssk]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug