hindent icon indicating copy to clipboard operation
hindent copied to clipboard

stack install hindent fails

Open Frank-Buss opened this issue 4 years ago • 12 comments

When I try to install it with "stack install hindent", I get this error:

indent> [3 of 5] Compiling HIndent.Types
hindent> 
hindent> /tmp/stack25973/hindent-5.3.1/src/HIndent/Types.hs:78:27: error:
hindent>     • Could not deduce (MonadFail m) arising from a use of ‘fail’
hindent>       from the context: Monad m
hindent>         bound by the type signature for:
hindent>                    readExtension :: forall (m :: * -> *).
hindent>                                     Monad m =>
hindent>                                     String -> m Extension
hindent>         at src/HIndent/Types.hs:74:1-49
hindent>       Possible fix:
hindent>         add (MonadFail m) to the context of
hindent>           the type signature for:
hindent>             readExtension :: forall (m :: * -> *).
hindent>                              Monad m =>
hindent>                              String -> m Extension
hindent>     • In the expression: fail ("Unknown extension: " ++ x)
hindent>       In a case alternative:
hindent>           UnknownExtension _ -> fail ("Unknown extension: " ++ x)
hindent>       In the expression:
hindent>         case classifyExtension x of
hindent>           UnknownExtension _ -> fail ("Unknown extension: " ++ x)
hindent>           x' -> return x'
hindent>    |
hindent> 78 |     UnknownExtension _ -> fail ("Unknown extension: " ++ x)
hindent>    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hindent>

Frank-Buss avatar Mar 19 '20 04:03 Frank-Buss

Same here

lsund avatar Mar 21 '20 09:03 lsund

Seems to be a problem with newer ghci versions. You can still install it using stack resolver: lts-14.22 for example

froth avatar Mar 21 '20 10:03 froth

Can confirm that lts-14.22 works.

lsund avatar Mar 21 '20 12:03 lsund

Thanks, 14.22 works. Full command line was this, in case someone is searching for it: "stack --resolver lts-14.22 install hindent". But would be better if it would work with the latest ghci.

Frank-Buss avatar Mar 21 '20 17:03 Frank-Buss

There actually is a pull request for it: https://github.com/chrisdone/hindent/pull/555 But as hindent is unmaintained at the moment: https://github.com/chrisdone/hindent/issues/557 I think for the moment this is what we are stuck with.

froth avatar Mar 21 '20 17:03 froth

It also works with 14.27. But building with GHC 8.8.x resolvers fails the way shown above.

mouse07410 avatar May 02 '20 03:05 mouse07410

GHC 8.8 and beyond changed how failures in monads are handled. fail is no longer a function of the Monad type class, instead developers are asked to implement their types as instances of the MonadFail type class. GHC 8.6 still supports the "old" way of doing things. It would be worthwhile to transition the monads in this library to be instances of the MonadFail typeclass.

dhruvio avatar Jul 14 '20 04:07 dhruvio

I implemented a fix for the issue described in my comment ^ in PR https://github.com/mihaimaruseac/hindent/pull/567

dhruvio avatar Jul 17 '20 00:07 dhruvio

When I try to install it with "stack install hindent", I get this error:

indent> [3 of 5] Compiling HIndent.Types
hindent> 
hindent> /tmp/stack25973/hindent-5.3.1/src/HIndent/Types.hs:78:27: error:
hindent>     • Could not deduce (MonadFail m) arising from a use of ‘fail’
hindent>       from the context: Monad m
hindent>         bound by the type signature for:
hindent>                    readExtension :: forall (m :: * -> *).
hindent>                                     Monad m =>
hindent>                                     String -> m Extension
hindent>         at src/HIndent/Types.hs:74:1-49
hindent>       Possible fix:
hindent>         add (MonadFail m) to the context of
hindent>           the type signature for:
hindent>             readExtension :: forall (m :: * -> *).
hindent>                              Monad m =>
hindent>                              String -> m Extension
hindent>     • In the expression: fail ("Unknown extension: " ++ x)
hindent>       In a case alternative:
hindent>           UnknownExtension _ -> fail ("Unknown extension: " ++ x)
hindent>       In the expression:
hindent>         case classifyExtension x of
hindent>           UnknownExtension _ -> fail ("Unknown extension: " ++ x)
hindent>           x' -> return x'
hindent>    |
hindent> 78 |     UnknownExtension _ -> fail ("Unknown extension: " ++ x)
hindent>    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hindent>

I guess this is a problem with hackage/stackage(whatever). The problem was completely solved when you clone the github repo and run a cabal install in the directory

Spidy104 avatar Oct 01 '20 03:10 Spidy104

Yes, I am currently working on a fix to support newer GHC. Though this is a side project and I'm swamped with work for job so this will take slightly longer.

mihaimaruseac avatar Oct 11 '20 17:10 mihaimaruseac

Yes, I am currently working on a fix to support newer GHC. Though this is a side project and I'm swamped with work for job so this will take slightly longer.

I'd be happy to help you on this!

isaac025 avatar Jan 21 '21 21:01 isaac025

I successfully compiled hindent with GHC 8.10.4 so I think this can be closed.

bergmark avatar Feb 15 '21 18:02 bergmark