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 -> ()
| ^