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

MonadFail instance for GHC 8.6 #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mtolly
Copy link

@mtolly mtolly commented Nov 30, 2018

Closes #21

CPP-limited to base 4.9.0.0 and up based on the info here.

@nomeata
Copy link

nomeata commented Jan 19, 2019

@mtolly, do you have an interest in maybe taking over maintainership of HPDF on hackage?

@dten
Copy link

dten commented Jan 24, 2019

won't compile for me with base-4.10.1.0

Graphics/PDF/Draw.hs:204:27: error:
        • No instance for (Fail.MonadFail (ST s))
            arising from a use of ‘Fail.fail’
        • In the expression: Fail.fail s
          In the second argument of ‘($)’, namely ‘\ _ -> Fail.fail s’
          In the expression: Draw $ \ _ -> Fail.fail s
        |
    204 |     fail s = Draw $ \_ -> Fail.fail s
        |                           ^^^^^^^^^^^

@dten
Copy link

dten commented Jan 24, 2019

@mtolly
Copy link
Author

mtolly commented Feb 28, 2019

Thanks @dten, I've edited the commit with that. Though it looks like #23 would be a better change to use; the MonadFail instance is overkill since it was only used for one failing do pattern.

@nomeata Tbh I probably wouldn't be the best person - I could maybe keep up with basic compiler fixes and that sort of thing but I don't know much of anything about the PDF format internals.

@dten
Copy link

dten commented Mar 1, 2019

That pr has a lot more changes in it. Your change worked and I was easy to verify 👍

@@ -186,6 +189,11 @@ instance Monad Draw where
unDraw (f a) env
return x = Draw $ \_env -> return x

#if MIN_VERSION_base(4,11,0)
instance Fail.MonadFail Draw where
fail s = Draw $ \_ -> Fail.fail s
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my view this is the wrong way to go. the reason the original code was actually fine, was that the list is defined to be infinite, so that should be expressed by using, e.g., http://hackage.haskell.org/package/inflist-0.0.1/docs/src/Data-InfList.html#InfList

i've implemented that here: #27

@hsyl20
Copy link

hsyl20 commented Jun 11, 2020

Fixed in 1.5.0

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

Successfully merging this pull request may close these issues.

MonadFail compatibility
5 participants