Skip to content

Instantly share code, notes, and snippets.

@mrkgnao
Last active May 3, 2017 13:22
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 mrkgnao/2853523c2ec7b9934857f52c049a45d9 to your computer and use it in GitHub Desktop.
Save mrkgnao/2853523c2ec7b9934857f52c049a45d9 to your computer and use it in GitHub Desktop.
GHC Trac #13568

Without DataKinds:

$ cat A.hs B.hs
module A where

data T = A
module B where

import A

data S = A

foo :: A -> ()
foo = undefined
$ ghc-dev A.hs B.hs                           
[2 of 2] Compiling B                ( B.hs, B.o )

B.hs:7:8: error:
    Not in scope: type constructor or class ‘A’
    A data constructor of that name is in scope; did you mean DataKinds?
  |
7 | foo :: A -> ()
  |        ^

With DataKinds:

$ cat A.hs B.hs
module A where

data T = A
{-# LANGUAGE DataKinds #-}
module B where

import A

data S = A

foo :: A -> ()
foo = undefined
$ ghc-dev A.hs B.hs
[2 of 2] Compiling B                ( B.hs, B.o )

B.hs:8:8: error:
    Ambiguous occurrence ‘A’
    It could refer to either ‘A.A’, imported from ‘A’ at B.hs:4:1-8
                          or ‘B.A’, defined at B.hs:6:10
  |
8 | foo :: A -> ()
  |        ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment