[Haskell-cafe] ghc-9 needs type declaration where ghc-8 didn't (with RankNTypes)
dburke.gw at gmail.com
Thu Oct 1 16:26:49 UTC 2020
The 9.0 upgrade may help:
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 18.104.22.16800925: 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:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe