
#10181: Lint check: arity invariant -------------------------------------+------------------------------------- Reporter: nomeata | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:751 -------------------------------------+------------------------------------- Changes (by nomeata): * cc: thomie (added) * owner: nomeata => * status: closed => new * resolution: fixed => Comment: thomie notified me of a a case of this lint check firing, triggered by simply `t a = t a`. Here is what’s happening: {{{ ==================== Simplifier ==================== Max iterations = 4 SimplMode {Phase = 2 [main], inline, rules, eta-expand, case-of-case} Result size of Simplifier = {terms: 2, types: 4, coercions: 0} Rec { t [Occ=LoopBreaker] :: forall t_ans t_ant. t_ans -> t_ant [LclIdX, Arity=1, Str=DmdType] t = t end Rec } [...] ==================== Demand analysis ==================== Result size of Demand analysis = {terms: 2, types: 4, coercions: 0} Rec { t [Occ=LoopBreaker] :: forall t_ans t_ant. t_ans -> t_ant [LclIdX, Arity=1, Str=DmdType b] t = t end Rec } *** Core Linted result of Demand analysis: *** Core Lint errors : in result of Demand analysis *** T10181.hs:3:1: warning: [RHS of t :: forall t_ans t_ant. t_ans -> t_ant] idArity 1 exceeds arity imposed by the strictness signature DmdType b: t }}} So there are several possibilities: * The simplifier should not set the `idArity` of `t` if after simplification, it does not have that arity. * `idArtiy t = 1` is correct, as that is the arity provided by the programmer. In that case, the lint check is bogus. * The demand analysis should enforce the the invariant if it adds a bottoming signature. This requires some insight with someone with the big picture in mind. Simon? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10181#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler