hindent
hindent copied to clipboard
stack install hindent fails
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>
Same here
Seems to be a problem with newer ghci versions. You can still install it using stack resolver: lts-14.22 for example
Can confirm that lts-14.22 works.
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.
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.
It also works with 14.27. But building with GHC 8.8.x resolvers fails the way shown above.
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.
I implemented a fix for the issue described in my comment ^ in PR https://github.com/mihaimaruseac/hindent/pull/567
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
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.
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!
I successfully compiled hindent with GHC 8.10.4 so I think this can be closed.