floskell icon indicating copy to clipboard operation
floskell copied to clipboard

Can not run floskell

Open flip111 opened this issue 4 years ago • 2 comments

 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.

flip111 avatar Feb 11 '21 16:02 flip111

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.

ennocramer avatar Feb 12 '21 07:02 ennocramer

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.

flip111 avatar Feb 12 '21 17:02 flip111