[Hackage] #893: Bad cabal build error message with mangled top of file

Hackage cvs-ghc at haskell.org
Sun Oct 2 14:56:23 CEST 2011

#893: Bad cabal build error message with mangled top of file
  Reporter:  rrnewton         |        Owner:         
      Type:  defect           |       Status:  new    
  Priority:  low              |    Milestone:         
 Component:  Cabal library    |      Version:
  Severity:  normal           |     Keywords:         
Difficulty:  easy (<4 hours)  |   Ghcversion:         
  Platform:                   |  
 I accidentally executed an Emacs keystroke that switched tokens around and
 mangled the top of my file:

 {-# Language BangPatterns, CPP #-} # OPTIONS_GHC
 {--fno-warn-name-shadowing -fwarn-unused-imports #-}

 When GHC is run directly on this file it gives a sensible error message

     Control/Monad/Par/Stream.hs:1:36: parse error on input `#'

 But when building through cabal build it looks like there is a module-
 name-finding heuristic that is failing (and defaulting to Main), resulting
 in this weird error message:

     Building monad-par-
         File name does not match module name:
         Saw: `Main'
         Expected: `Control.Monad.Par.Stream'

 Which really caused me to scratch my head when I saw it ;-).   ("No where
 does it say Main!!")  I was afraid I had messed up paths and was loading a
 different version of the file from another directory or something...

Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/893>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects

More information about the cabal-devel mailing list