Skip to content

Instantly share code, notes, and snippets.

@int-index
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int-index/bf5cd1a200257a53c0fc to your computer and use it in GitHub Desktop.
Save int-index/bf5cd1a200257a53c0fc to your computer and use it in GitHub Desktop.
GHC 7.10 bug
{-# LANGUAGE PartialTypeSignatures #-}
module Main where
data I a = I a
instance Functor I where
fmap f (I a) = I (f a)
newtype B t a = B a
instance Functor (B t) where
fmap f (B a) = B (f a)
newtype H f = H (f ())
app :: H (B t)
app = h (H . I) (B ())
h :: _
--h :: Functor m => (a -> b) -> m a -> H m
h f b = (H . fmap (const ())) (fmap f b)
-- the compiler crashes if the signature is partial (involves underscores)
--
-- it does not crash if the signature is specified completely or isn't
-- specified at all (inferred)
Bug.hs:15:10:
Couldn't match type `b' with `H I'
`b' is untouchable
inside the constraints ()
bound by the type signature for app :: H (B t)
at Bug.hs:14:8-14ghc: panic! (the 'impossible' happened)
(GHC version 7.10.1 for x86_64-unknown-linux):
No skolem info: b_a3gc[sk]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment