Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not run floskell #57

Open
flip111 opened this issue Feb 11, 2021 · 2 comments
Open

Can not run floskell #57

flip111 opened this issue Feb 11, 2021 · 2 comments

Comments

@flip111
Copy link
Contributor

flip111 commented Feb 11, 2021

 floskell --config floskell.json $(find . -iname '*.hs')
floskell.exe: floskell.json: endOfInput, at line 21, column 0
CallStack (from HasCallStack):
  error, called at src/Floskell\ConfigFile.hs:193:13 in floskell-0.10.5-7q3J7U12hgkCoOTj4Rcz7p:Floskell.ConfigFile
{
  "language": "Haskell2010",
  "extensions": [],
  "style": "base",
  "formatting": {
    "layout": {
      "app": "try-oneline",
      "con-decls": "try-oneline",
      "declaration": "try-oneline",
      "export-spec-list": "try-oneline",
      "if": "try-oneline",
      "import-spec-list": "try-oneline",
      "infix-app": "try-oneline",
      "let": "try-oneline",
      "list-comp": "try-oneline",
      "record": "try-oneline",
      "type": "try-oneline"
      }
    }
  }
}
$ floskell --style base $(find . -iname '*.hs')
floskell.exe: ./app/Main.hs:195:47: Parse error: =>
CallStack (from HasCallStack):
  error, called at src\main\Main.hs:161:12 in main:Main

line 195:

instance {-# OVERLAPPABLE #-} f :<: A => B f where

first time i tried floskell. Reading through the readme is quite tedious because:

  1. general description of things is in readme
  2. also more or less same information is here https://github.com/ennocramer/floskell/blob/master/CONFIGURATION.md
  3. additional information needs to be get from floskell --help (like styles available)
  4. missing examples how a style affects something

Would be better to put everything in one place and go item by item how to put the config file together with for each item examples. And also what are the defaults for each style or which config can also be passed on command line.

Thanks for the effort with floskell though. Maybe i give it another look some time.

@ennocramer
Copy link
Owner

I'm sorry you had a bad experience trying out Floskell. The error messages are unfortunately quite cryptic sometimes.

Your first issue stems from a left-over closing curly brace on line 18. Remove that and Floskell will accept your configuration file.

The second issue seems to be haskell-src-exts parser not supporting TypeOperators too well, as both

instance {-# OVERLAPPABLE #-} (:<:) f A => B f where

and

instance {-# OVERLAPPABLE #-} (f :<: A) => B f where

are accepted.

Given the state of haskell-src-exts (see also #35), moving to GHC's parser is probably a good idea, but I do not have the time to tackle that change at the moment.

@flip111
Copy link
Contributor Author

flip111 commented Feb 12, 2021

It's cool that you took hindent and tried to improve on it. These days things seem to be a bit in flux with haskell-src-exts and so. Unfortunately the number one alternative ghc-lib-parser is mainly good with parsing, probably no pretty print facilities, though i didn't check it out in depth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants