Skip to content

Instantly share code, notes, and snippets.

@alpmestan
Created August 17, 2017 10:48
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 alpmestan/10adc48ffaef233c4659af864bd60d32 to your computer and use it in GitHub Desktop.
Save alpmestan/10adc48ffaef233c4659af864bd60d32 to your computer and use it in GitHub Desktop.
-- similar to https://ghc.haskell.org/trac/ghc/ticket/12468
-- except that I'm trying with 8.2.1
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Prelude> :set -XGADTs
Prelude> data Foo a where Foo :: Int -> Foo Bool
Prelude> f :: Foo a -> a ; f (Foo n) = _k n
<interactive>:3:31: error:
• Found hole: _k :: Int -> a
Where: ‘a’ is a rigid type variable bound by
the type signature for:
f :: forall a. Foo a -> a
at <interactive>:3:1-15
Or perhaps ‘_k’ is mis-spelled, or not in scope
• In the expression: _k
In the expression: _k n
In an equation for ‘f’: f (Foo n) = _k n
• Relevant bindings include
n :: Int (bound at <interactive>:3:26)
f :: Foo a -> a (bound at <interactive>:3:19)
-- I was expecting that the a ~ Int equality would be in scope when
-- typechecking the hole _k, therefore _k :: Int -> Bool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment