CurryInfo: stylechecker-2.0.0 / Check.AST.Pattern.ConstFunc.checkConstFunc

definition:
checkConstFunc :: Expression a -> Int -> CSM ()
checkConstFunc e _ =
  case e of
    (Lambda
      sI
      [ (VariablePattern _ _ ident1)
      , (VariablePattern _ _ ident2)]
      (Variable _ _ (QualIdent _ _ ident3))) -> do when (ident1 == ident3)
                                                     (report ( Message
                                                               (getSpan sI)
                                                               ( text "superfluous code"
                                                               <+> colorizeKey "\\x y -> x"
                                                               )
                                                               ( text "instead of"
                                                               <+> colorizeKey "\\x y -> x"
                                                               <+> text "write"
                                                               <+> colorizeKey "const"
                                                               )
                                                             )
                                                     )
                                                   when (ident3 == ident2)
                                                     (report ( Message
                                                               (getSpan sI)
                                                               ( text "superfluous code"
                                                               <+> colorizeKey "\\x y -> y"
                                                               )
                                                               ( text "instead of"
                                                               <+> colorizeKey "\\x y -> y"
                                                               <+> text "write"
                                                               <+> colorizeKey "const"
                                                               <+> text "and switch parameters"
                                                               )
                                                             )
                                                     )
    _                                       -> return ()
demand:
argument 1
deterministic:
deterministic operation
documentation:
-- Checks if the lambda function `\x y -> x` occurs in the code.
-- If so, a warning is emitted to use `const` instead.
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{({Lambda},_) |-> _ || ({Literal},_) |-> _ || ({Variable},_) |-> _ || ({Constructor},_) |-> _ || ({Paren},_) |-> _ || ({Typed},_) |-> _ || ({Record},_) |-> _ || ({RecordUpdate},_) |-> _ || ({Tuple},_) |-> _ || ({List},_) |-> _ || ({ListCompr},_) |-> _ || ({EnumFrom},_) |-> _ || ({EnumFromThen},_) |-> _ || ({EnumFromTo},_) |-> _ || ({EnumFromThenTo},_) |-> _ || ({UnaryMinus},_) |-> _ || ({Apply},_) |-> _ || ({InfixApply},_) |-> _ || ({LeftSection},_) |-> _ || ({RightSection},_) |-> _ || ({Let},_) |-> _ || ({Do},_) |-> _ || ({IfThenElse},_) |-> _ || ({Case},_) |-> _}
name:
checkConstFunc
precedence:
no precedence defined
result-values:
_
signature:
Curry.Types.Expression a -> Prelude.Int
-> Control.Monad.Trans.State.StateT Types.CheckState Data.Functor.Identity.Identity ()
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term