haskell / haskell/stylish-haskell

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

Open
#181 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.