
Hello I've been doing some work with mutually recursive modules (MRMs). I'm familiar with the section in the User's Guide on how to do this and have successfully worked with MRMs with simple dependencies. However, I have created a set of MRMs that I can't seem to get to compile because of type issues. I can get the code to compile by combining all of the modules into a single, monolithic module; however, this breaks the conceptual design that I'm going for. I may also be able to break the modules into smaller pieces that will compile, though I'm not sure about this and it, too, would break the conceptual design. Does the current {-# SOURCE #-}/.hs-boot scheme allow for compilation of arbitrary MRMs? Or are there known cases where it doesn't work? If there are cases where it doesn't work, are there other options? Someone in Haskell Cafe mentioned that GHC 6.2 used a different scheme for MRMs (.hi-boot). Is it still possible to use this? Would it allow for compilation of arbitrary MRMs? I can create a minimal case as an example, if it would be useful. Thanks, Richard

On Thu, Jun 5, 2008 at 4:46 PM, Richard Giraud
Does the current {-# SOURCE #-}/.hs-boot scheme allow for compilation of arbitrary MRMs? Or are there known cases where it doesn't work? If there are cases where it doesn't work, are there other options?
I don't think the .hs-boot method can deal with having a set of mutually recursive types split by module boundaries. If all you want to do is keep your API clean, you can stick all of your types in one monolithic module that isn't exposed by the package, and then re-export them in public modules. -Antoine

Antoine Latter wrote:
On Thu, Jun 5, 2008 at 4:46 PM, Richard Giraud
wrote: Does the current {-# SOURCE #-}/.hs-boot scheme allow for compilation of arbitrary MRMs? Or are there known cases where it doesn't work? If there are cases where it doesn't work, are there other options?
I don't think the .hs-boot method can deal with having a set of mutually recursive types split by module boundaries.
sometimes it can, I think
If all you want to do is keep your API clean, you can stick all of your types in one monolithic module that isn't exposed by the package, and then re-export them in public modules.
Yeah, remember that you only have to put (some of) your types together -- you can spread out your functions in your modules any way you want. -Isaac

Richard I'm assuming you have ready the GHC manual? http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation... Yes, mutually recursive modules are fine (in GHC anyway), and should work as advertised there. Please do produce a test case if not. Thanks Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On | Behalf Of Richard Giraud | Sent: 05 June 2008 22:46 | To: GHC Users Mailing List | Subject: Mutually recursive modules | | Hello | | I've been doing some work with mutually recursive modules (MRMs). I'm | familiar with the section in the User's Guide on how to do this and have | successfully worked with MRMs with simple dependencies. However, I have | created a set of MRMs that I can't seem to get to compile because of | type issues. | | I can get the code to compile by combining all of the modules into a | single, monolithic module; however, this breaks the conceptual design | that I'm going for. I may also be able to break the modules into | smaller pieces that will compile, though I'm not sure about this and it, | too, would break the conceptual design. | | Does the current {-# SOURCE #-}/.hs-boot scheme allow for compilation of | arbitrary MRMs? Or are there known cases where it doesn't work? If | there are cases where it doesn't work, are there other options? | | Someone in Haskell Cafe mentioned that GHC 6.2 used a different scheme | for MRMs (.hi-boot). Is it still possible to use this? Would it allow | for compilation of arbitrary MRMs? | | I can create a minimal case as an example, if it would be useful. | | Thanks, | | Richard | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (4)
-
Antoine Latter
-
Isaac Dupree
-
Richard Giraud
-
Simon Peyton-Jones