Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way of including files/directories in Fay?

Tags:

haskell

fay

I am trying to compile haskell to JS using Fay with one directory after the --include option like so:

fay --include src\Tmv src\Tmv\Client\Main.hs

There is a SharedTypes.hs file in src\Tmv which defines a module Tmv.SharedTypes that is used in Client\Main.hs. I get the following error:

Could not find module "Tmv.SharedTypes". Use -v to see a list of files searched for.

The -v option does not work. I have tried several variations of the parameters, eg. absolute paths, quotation marks, escaped (double) backslashes.
Configuration: fay 0.10.1.0, ghc 7.4.2 (i386), Windows 7 x64

like image 622
Jann Müller Avatar asked Dec 20 '12 16:12

Jann Müller


1 Answers

Moving this from a comment, since it apparently resolved the problem:

When GHC looks for source files, normally it expects a module Foo.Bar to be found as Bar.hs in a subdirectory Foo, relative to whatever "root" directory it starts from. For example, if you start GHCi with Foo as the current directory, you'll have problems with the module Bar either not being found, or errors because the module name won't match what GHC expects.

Since the same rules seem to be in play in your case, to import Tmv.SharedTypes you want SharedTypes.hs to be in a Tmv subdirectory of whatever the base path is, so either creating another Tmv subdirectory or specifying src alone for --include should work.

like image 61
C. A. McCann Avatar answered Oct 04 '22 21:10

C. A. McCann