Re: monomorphism restriction vs unused
Evan Laforge <[email protected]> Tue, 23 Jun 2026 00:41:02 -0700
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <CACbaDy77Qrvy+gxSLSV5niLCSitPXOfresvqqX4tJRi3XnJ2bw@mail.gmail.com> |
> With just the quoted above code fragment and
> "NoMonomorphismRestriction", testing a range of compiler versions I only
> see the reported "GHC Bug #20076" with GHC 9.4 and 9.6, but the code
> compiles successfully only with a now somewhat dated GHC 10.0 snapshot I
> built back in April.
I was in fact on 9.6, and in further fact had only recently upgraded
to that! However, while trying to track down a module loading bug, I
upgraded again to 9.12.4, and I get the same "Ambiguous type variable"
you got above.
Is it actually ambiguous? To the bare eye it still looks to me like
it should be pretty clearly forced to be PitchClass by the Pitch call.
fromEnum is forced in the same way.
In any case, it's easily worked around with a type annotation. All of
the literals becoming ambiguous is a bigger problem!
I wound up just pasting a bunch of {-# LANUAGE
NoMonomorphismRestriction #-} only on the specific DSL-using modules,
that's good enough and better targeted, perhaps it was the right
solution all along. Now I'm just curious about why ghc can't figure
out the types.
_______________________________________________
Haskell-Cafe mailing list -- [email protected]
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.