2017-03-01 36 views
0

在我的Haskell的项目,我有以下目录结构(一些条目失踪,但这个问题不相关)哈斯克尔阴谋迷惑有关文件和模块名

- quanthas 
    - quanthas.cabal 
    - src/ 
     - QuantHas/ 
     - Settings.hs 

我Settings.hs文件中包含该模块头

module QuantHas.Settings(module QuantHas.Settings) where 

我的阴谋文件看起来像这样

Name:    QuantHas 
Version:   0.0 
Description: 
    QuantHas project is an attempt to port QuantLib to Haskell keeping the functional flavor of Haskell. 
License:   BSD3 
License-file:  LICENSE 
Build-Type:   Simple 
Cabal-Version:  >=1.10 

Library 
    Build-Depends: base >= 3 && < 5, array >= 0.2 
    Exposed-modules: QuantHas.Time.Frequency 
       QuantHas.Time.TimeUnit 
       QuantHas.Time.Period 
       QuantHas.Time.Date 
       QuantHas.Time.DayCounter 
       QuantHas.Time.BusinessDayConvention 
       QuantHas.Time.Calendar 
       QuantHas.Time.Calendars.UnitedKingdom 
       QuantHas.Time.Schedule 
       QuantHas.Settings 
       QuantHas.Require 
    default-language: Haskell2010     
    hs-source-dirs: src 
    -- ghc-options:  -Wall 

test-suite QuantHas-tests 
    type: exitcode-stdio-1.0 
    hs-source-dirs: testsuite 
    main-is: Tests.hs 
    default-language: Haskell2010 

当我执行

cabal install --enable-tests 

我得到这个消息

src/Quanthas/Settings.hs:17:8: error: 
    File name does not match module name: 
    Saw: ‘QuantHas.Settings’ 
    Expected: ‘Quanthas.Settings’ 

这似乎是错误的。但是,如果我们做什么cabal期望。所以Settings.hs模块头现在是

module Quanthas.Settings(module Quanthas.Settings) where 

卡瓦尔说,现在

src/QuantHas/Settings.hs:17:8: error: 
    File name does not match module name: 
    Saw: ‘Quanthas.Settings’ 
    Expected: ‘QuantHas.Settings’ 

而且它在这个ppint,我放弃了,转而左右。任何人都可以帮助我理解发生了什么?

版本信息: 平台:的MacBook Pro运行的MacOS 10.12.3 哈斯克尔:8.0.1 惊天动地:1.24.0.0

谢谢!

+0

那么你确定文件系统中的'QuantHas'目录是用大写'H'命名的吗?如果是这样,你做了一些像小写字母开头,然后重命名它?想知道如果它可以是一些缓存的东西。 –

+0

是的,它在目录名称中总是有'H'。 –

+0

更改后试过'cabal configure'吗? – arrowd

回答

1

问题是在其他模块中的某个导入语句中存在拼写错误。由于您处于不区分大小写的文件系统(OS X),因此GHC能够找到模块内容,但在检查模块标头时发现它与导入语句不匹配,并且出错。