Bugs item #1039993, was opened at 2004-10-04 10:41
Message generated for change (Comment added) made by jcast
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1039993&group_id=8032

Category: Compiler
Group: 6.2.1
Status: Closed
Resolution: Wont Fix
Priority: 5
Submitted By: Jon Cast (jcast)
Assigned to: Nobody/Anonymous (nobody)
Summary: ghc --make + hi-boot + class declarations = trouble

Initial Comment:
Consider the following test case:

-- Main.hs --
module Main where

import Module1
import Module2

main = return ()

-- Module1.hs --
module Module1 where

import Module2

class Three alpha where
  three :: Kappa alpha -> Kappa alpha -> Kappa alpha

-- Module1.hi-boot --
module Module2 where

import {-# SOURCE #-} Module1

data Kappa alpha = Kappa alpha alpha

f :: Three alpha => Kappa alpha -> alpha
f k = case three k k of
        Kappa x y -> x

-- Module1.hi-boot --
module Module1 where

class Three alpha where
  three :: Module2.Kappa alpha -> Module2.Kappa alpha
        -> Module2.Kappa alpha

-- Compilation Results --
cd /home/jcast/Source/tmp/      # -*-compilation-*-
Entering directory `/home/jcast/Source/tmp/'
ghc --make Main
Chasing modules from: Main
Compiling Module2          ( ./Module2.hs, ./Module2.o )

./Module2.hs:1:
    Failed to find interface decl for `Module1.$dmthree'
    from module `Module1'

Compilation exited abnormally with code 1 at Mon Oct  4
09:38:50

No, for the real program it's not strictly necessary to
employ mutual recursion between the modules in
question---but it is by far the most natural design.

----------------------------------------------------------------------

>Comment By: Jon Cast (jcast)
Date: 2004-10-10 17:05

Message:
Logged In: YES 
user_id=762054

Ok, thanks for the clarification.

----------------------------------------------------------------------

Comment By: Simon Peyton Jones (simonpj)
Date: 2004-10-05 03:23

Message:
Logged In: YES 
user_id=50165

You can't put class signatures in a hi-boot file.  (The 
documentation should say this, and will soon; and the error 
message will be better.)

Instead, write the sig for the class op as a separate top-level 
defn in the hi-boot file
  three :: Three alpha => ...type as before...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1039993&group_id=8032
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to