[GHC] #12106: Wrong type inferenced for locally defined function