atom-haskell / ide-haskell

Haskell IDE plugin for Atom editor

Home Page:https://atom.io/packages/ide-haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prettify swallows stylish-haskell errors

ramirez7 opened this issue · comments

Example file:

module Example where
import Control.Monad.Except (MonadError(..))

orFail :: MonadError e m => Maybe a -> e -> m a
orFail (Just a) _ = pure a
orFail Nothing e = throwError e

If I Prettify this file in Atom, nothing happens, and I don't get any indication of why.

If I run stylish-haskell on this file, I get the following output:

Armandos-MacBook-Pro% stylish-haskell src/Example.hs                
Language.Haskell.Stylish.Parse.parseModule: could not parse src/Example.hs: \
ParseFailed (SrcLoc "<unknown>.hs" 4 29) "MultiParamTypeClasses language \
extension is not enabled. Please add {-# LANGUAGE MultiParamTypeClasses #-} \
pragma at the top of your module."
module Example where
import Control.Monad.Except (MonadError(..))

orFail :: MonadError e m => Maybe a -> e -> m a
orFail (Just a) _ = pure a
orFail Nothing e = throwError e

Once I add {-# LANGUAGE MultiParamTypeClasses #-} to my file, Prettify works in Atom.

It looks like this might be stylish-haskell's fault, as it returns 0 despite failing to parse the file.

Seems to be fixed upstream. Also fixed in ide-haskell a while ago.