xnyhps / ghc

Mirror of ghc repository. DO NOT SUBMIT PULL REQUESTS HERE
http://www.haskell.org/ghc/
Other
3 stars 1 forks source link

-XNoMonomorphismRestriction: Holes aren't reported #1

Open xnyhps opened 12 years ago

xnyhps commented 12 years ago

Opening the following module with -XNoMonomorphismRestriction:

f = _?h >>= _?g

Causes the holes to not be reported.

One of the differences in the log:

-XNoMonomorphismRestriction on:

solveWanteds finished with
  remaining_unsolved_flats = {}
  subst = [TvSubst In scope: InScope [] Type env: []]
simplifyCheck } unsolved = WC {}

Off:

solveWanteds finished with
  remaining_unsolved_flats = {[W] $dMonad :: Monad
                                               m_b {0} (CDictCan),
                              [W] _?h :: _?h (m_b a_c) {0} (CHoleCan),
                              [W] _?g :: _?g (a_c -> m_b b_d) {0} (CHoleCan)}
  subst = [TvSubst In scope: InScope [] Type env: []]
simplifyCheck }
  unsolved = WC {wc_flat = [W] $dMonad :: Monad m_b {0} (CDictCan)
                           [W] _?h :: _?h (m_b a_c) {0} (CHoleCan)
                           [W] _?g :: _?g (a_c -> m_b b_d) {0} (CHoleCan)}
xnyhps commented 12 years ago

However, giving the type signature manually does cause the holes to get reported:

f :: (Monad m) => m b
f = _?h >>= _?g
test.hs:2:5: Warning:
    Found hole _?h with type m a0
    In the first argument of `(>>=)', namely `_?h'
    In the expression: _?h >>= _?g
    In an equation for `f': f = _?h >>= _?g

test.hs:2:13: Warning:
    Found hole _?g with type a0 -> m b
    In the second argument of `(>>=)', namely `_?g'
    In the expression: _?h >>= _?g
    In an equation for `f': f = _?h >>= _?g
Ok, modules loaded: Main.