Compiling mutually recursive modules involving instances
José Romildo Malaquias
romildo@urano.iceb.ufop.br
Tue, 24 Oct 2000 12:59:53 -0200
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Hello.
I am having difficulties in compiling mutually recursive
modules involving classes and instances in GHC 4.08.1.
Basicaly I am not finding how to write a .hi-boot where
I want to put classes and instances.
Consider a program with 3 modules: M1, M2 and Main. The
sources are attached to the message. What should go
into M2.hi-boot? Would anyone write M2.hi-boot for me
so that I can learn it.
Thanks.
Romildo
--
Prof. José Romildo Malaquias <romildo@iceb.ufop.br>
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="M1.hs"
module M1 where
import {-# SOURCE #-} M2
class C a where
f :: a -> Bool
instance C a => C [a] where
f = or . map f
test = f [ 1 .. 10::Int ]
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="M2.hs"
module M2 where
import M1 ( C )
instance C Int where
f x = mod x 3 == 0
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="Main.hs"
module Main where
import M1 (test)
main = putStrLn (show test)
--tThc/1wpZn/ma/RB--