foo : Int -> Intfoo x =
let
somethingIShouldDefineOnTopLevel : Int -> Int
somethingIShouldDefineOnTopLevel y =
y + 1in
somethingIShouldDefineOnTopLevel x
Success
somethingIShouldDefineOnTopLevel : Int -> IntsomethingIShouldDefineOnTopLevel y =
y + 1foo : Int -> Intfoo x =
somethingIShouldDefineOnTopLevel x
When (not) to enable this rule
Just don't enable this - whilst it's a good basic rule of thumb, there often needs to be much more to this review than this simple rule can account for.
Try it out
You can try this rule out by running the following command:
Reports functions declared in
let
expressions.config = [ NoFunctionInLet.rule ]
Fail
foo : Int -> Int foo x = let somethingIShouldDefineOnTopLevel : Int -> Int somethingIShouldDefineOnTopLevel y = y + 1 in somethingIShouldDefineOnTopLevel x
Success
somethingIShouldDefineOnTopLevel : Int -> Int somethingIShouldDefineOnTopLevel y = y + 1 foo : Int -> Int foo x = somethingIShouldDefineOnTopLevel x
When (not) to enable this rule
Just don't enable this - whilst it's a good basic rule of thumb, there often needs to be much more to this review than this simple rule can account for.
Try it out
You can try this rule out by running the following command: