-
Notifications
You must be signed in to change notification settings - Fork 62
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
[Question] is there an easier way to have "multi-main" with IO action support? #293
Comments
Good question. Actually, off the top of my head I see no reason we can't generalize the instance in
We already have an instance |
You could write the generalised instance in I've actually done this instance in my rewrite although the class is a little different there. I'll write a similar version for HEAD. |
Looking at the comment for
But I feel like the instance generalises nicely. I can't think of any reason a backend would want a different instance. Is everyone happy with writing a Note that writing that instance in |
I think I wrote that comment thinking about the |
Yes, sounds good to me. Let's put the general instance in |
@cchalmers did we ever get around to this? If not, I can do it. |
@byorgey I remember looking at it but I must have forgot. |
Let's say we have the following code:
now suppose I want to have a circle of random size, or whatever action with IO involved.
while I could have performed all IO actions and still passing
[(String, Diagram B)]
tomainWith
, but that's way too eager. so I turn the argument ofmainWith
to be[(String, IO (Diagram B))]
(as the actual IO action does not really matter, I've omitted them to leave justpure
s):then GHC starts to complain about a missing instance of
Mainable [(String, IO (Diagram B))]
.this leads me to have to write the following stuff out in full (together with
FlexibleInstances
,TypeFamilies
and probably-fno-warn-orphans
):despite that there is a very close one in svg lib (i.e.
Mainable [(String, Diagram B)]
) but I really doubt GHC can figure this out by itself.Is there anything to make this a bit easier, I don't really expect something that sounds easy to be this involved.
The text was updated successfully, but these errors were encountered: