stylish-haskell icon indicating copy to clipboard operation
stylish-haskell copied to clipboard

Language.Haskell.Stylish.Parse.parseModule: could not parse <unknown>: ParseFailed (SrcLoc "<unknown>.hs" 4 3) "Parse error: prompt"

Open nbro opened this issue 8 years ago • 1 comments

I'm getting the following error using Atom

Failed to prettify

Command failed: stylish-haskell Language.Haskell.Stylish.Parse.parseModule: could not parse : ParseFailed (SrcLoc ".hs" 4 3) "Parse error: prompt"

Hide Stack Trace

Error: Command failed: stylish-haskell Language.Haskell.Stylish.Parse.parseModule: could not parse : ParseFailed (SrcLoc ".hs" 4 3) "Parse error: prompt" at ChildProcess.exithandler (child_process.js:223:12) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:885:16) at Socket. (internal/child_process.js:334:11) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at Pipe._handle.close [as _onclose] (net.js:501:12)

or this (simplified) error from the terminal

Language.Haskell.Stylish.Parse.parseModule: could not parse app/Main.hs: ParseFailed (SrcLoc ".hs" 4 3) "Parse error: prompt"

when I try to use stylish-haskell to prettify the file Main.hs under app of a cabal/stack Haskell package.

Main.hs is the following simple file

module Main where
  import System.IO

  prompt :: String -> IO String
  prompt text = do
      putStr text
      hFlush stdout
      getLine

  main :: IO ()
  main = do

    input <- prompt "Enter your name: "
    putStrLn ("Hello " ++ input ++ "!")

Version of stylish-haskell: 0.8.1.0.

Is this the expected behaviour or is this a bug? If this is the expected behaviour, what's the rationale behind having chosen stylish-haskell to work like this?

nbro avatar Sep 09 '17 23:09 nbro

I do not receive the error above if I do not indent the lines starting from the import.

nbro avatar Sep 09 '17 23:09 nbro