[Haskell-cafe] ghc-9 needs type declaration where ghc-8 didn't (with RankNTypes)
Doug Burke
dburke.gw at gmail.com
Thu Oct 1 16:26:49 UTC 2020
The 9.0 upgrade may help:
https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0
On Thu, Oct 1, 2020 at 12:20 PM Johannes Waldmann <
johannes.waldmann at htwk-leipzig.de> wrote:
> Dear Cafe,
>
> and thanks, Georgi, for answering my previous question
>
> here's another difference I noticed
> (based on real code, but reduced to a minimal test case)
>
> GHCi, version 9.0.0.20200925: https://www.haskell.org/ghc/ :? for help
> Prelude> :set -XRankNTypes
> Prelude> let f :: (forall a . a -> ()) -> () ; f = g ; g x = undefined
>
> <interactive>:2:43: error:
> • Couldn't match type ‘p0’ with ‘forall a. a -> ()’
> Expected: (forall a. a -> ()) -> ()
> Actual: p0 -> ()
> Cannot instantiate unification variable ‘p0’
> with a type involving polytypes: forall a. a -> ()
> • In the expression: g
> In an equation for ‘f’: f = g
>
> The declaration is accepted by ghc-8.
> For ghc-9, I have to give a type signature for g (copy that of f),
> or replace `f = g` with `f x = g x`.
>
> - J.W.
> _______________________________________________
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20201001/4a6c6c2c/attachment.html>
More information about the Haskell-Cafe
mailing list