Skip to content

MonomorphismRestriction tries to monomorph ImplicitParams

Summary

MonomorphismRestriciton breaks type check of values that use ImplicitParams without signatures

Steps to reproduce

This code works fine:

{-# LANGUAGE ImplicitParams #-}
f _ = ?param

But this code fails to type check:

{-# LANGUAGE ImplicitParams #-}
f = ?param

with this error:

    • Unbound implicit parameter (?param::t0)
        arising from a use of implicit parameter ‘?param’
...

Expected behavior

If I enable NoMonomorphismRestriction, it works fine:

{-# LANGUAGE ImplicitParams, NoMonomorphismRestriction #-}
f = ?param

Implicit params aren't something that can be monomorphed, so I think that it's a bug.

Environment

  • GHC version used: all
Edited by Andrei Borzenkov
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information