[GHC] #9327: possibly incorrect indentation or mismatched brackets

GHC ghc-devs at haskell.org
Fri Jul 18 13:24:00 UTC 2014


#9327: possibly incorrect indentation or mismatched brackets
-------------------------------------+-------------------------------------
              Reporter:  Jefffrey    |             Owner:
                  Type:  bug         |            Status:  closed
              Priority:  low         |         Milestone:
             Component:  Compiler    |           Version:  7.6.3
            Resolution:  invalid     |          Keywords:
Differential Revisions:              |  Operating System:  MacOS X
          Architecture:              |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
            Difficulty:  Unknown     |         Test Case:
            Blocked By:              |          Blocking:
       Related Tickets:              |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 You are doing something very weird here, mixing two different levels of
 indentation.  I think you probably want
 {{{
     let ep = Bridge.destination b </> e
     ed <- doesDirectoryExist ep
     if ed
         then do
             ds <- listDirs ep
             let fn p = do -- The following three lines are part of the
 'do'
                           -- They are not new binding in the 'let', peer
 to 'fn'
                           let t = readUTC p
                           lt <- toLocalTime t
                           return $ Snapshot t lt e b
             l <- mapM fn ds
             let r = sortBy (compare `on` time) l
             let ri = Prelude.take m $ assignIDs 1 r
             if o == Oldest
                 then return $ ri
                 else return $ reverse ri
         else return []
 }}}
 If in doubt, use braces and semi-colons:
 {{{
     let ep = Bridge.destination b </> e
     ed <- doesDirectoryExist ep
     if ed
         then do
           { ds <- listDirs ep
           ; let fn p = do -- The following three lines are part of the
 'do'
                           -- They are not new binding in the 'let', peer
 to 'fn'
                           { let t = readUTC p
                           ; lt <- toLocalTime t
                           ; return $ Snapshot t lt e b }
           ;  l <- mapM fn ds
           ;  let r = sortBy (compare `on` time) l
           ;  let ri = Prelude.take m $ assignIDs 1 r
           ;  if o == Oldest
                 then return $ ri
                 else return $ reverse ri
           }
         else return []
 }}}

 Simon

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9327#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list