RebindableSyntax and fail in GHC 8

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RebindableSyntax and fail in GHC 8

Chris Smith-31
Hey everyone,

Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8?  Note that I do not have monad comprehensions enabled.  If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary.

Thanks,
Chris

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: RebindableSyntax and fail in GHC 8

Richard Eisenberg-4
Sounds like a bug to me.... and one I may have run into at some point. Would you care to file a bug report?

Thanks!
Richard

> On Dec 20, 2016, at 3:53 AM, Chris Smith <[hidden email]> wrote:
>
> Hey everyone,
>
> Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8?  Note that I do not have monad comprehensions enabled.  If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary.
>
> Thanks,
> Chris
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: RebindableSyntax and fail in GHC 8

David Menendez-2
In reply to this post by Chris Smith-31
On Tue, Dec 20, 2016 at 3:53 AM, Chris Smith <[hidden email]> wrote:
Hey everyone,

Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8?  Note that I do not have monad comprehensions enabled.  If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary.

Perhaps fail is used by the translation for guards. I don’t have a working GHC right now, but what happens if you define fail = error and evaluate [ x | x <- “a", False]?

--

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: RebindableSyntax and fail in GHC 8

Chris Smith-31
Thanks Richard, I will file the bug shortly.

David, fail doesn't appear to be used at all, either for pattern match failure (which I initially expected), or for guards.  Example here: https://code.world/#P2ZO5lhXKM5QGYh-vRd31Ug

On Wed, Dec 21, 2016 at 12:56 PM, David Menendez <[hidden email]> wrote:
On Tue, Dec 20, 2016 at 3:53 AM, Chris Smith <[hidden email]> wrote:
Hey everyone,

Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8?  Note that I do not have monad comprehensions enabled.  If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary.

Perhaps fail is used by the translation for guards. I don’t have a working GHC right now, but what happens if you define fail = error and evaluate [ x | x <- “a", False]?

--


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: RebindableSyntax and fail in GHC 8

Chris Smith-31
In reply to this post by Richard Eisenberg-4
Thanks for the response.  It appears the bug was already reported in a slightly different context.  https://ghc.haskell.org/trac/ghc/ticket/11216

On Wed, Dec 21, 2016 at 6:24 AM, Richard Eisenberg <[hidden email]> wrote:
Sounds like a bug to me.... and one I may have run into at some point. Would you care to file a bug report?

Thanks!
Richard

> On Dec 20, 2016, at 3:53 AM, Chris Smith <[hidden email]> wrote:
>
> Hey everyone,
>
> Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8?  Note that I do not have monad comprehensions enabled.  If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary.
>
> Thanks,
> Chris
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.