Skip to content

single-module recursion and import aliases

I put the following code in Foo.hs:

module Foo where
import Prelude (Either(..))
import {-# SOURCE #-} Foo as F
not (Left x) = x
not (Right x) = F.not (Left x)

And the following code in Foo.hs-boot:

module Foo where
import Prelude(Either)
not :: Either a a -> a

I get the following error when trying to compile:

% ghc -c Foo.hs-boot
% ghc -c Foo.hs

Foo.hs:5:17: Not in scope: ‘F.not’
zsh: exit 1     ghc -c Foo.hs

This surprises me, as running ghci on a slightly modified version (replacing F.not (Left x) with simply x) confirms that not is exported correctly; hence I believe F.not should indeed be in scope.

Trac metadata
Trac field Value
Version 7.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information