Linter output Compiler
Since our program seems to be functional we can do some refactoring and refinement.
Therefore I believe it's a good idea to share the linter output for Compiler.hs
.
It's totally up to you whether you follow these guidelines or not.
src/Compiler.hs|59 col 10-17 warning| Warning: Redundant bracket. Found: (Reset) Why not: Reset
src/Compiler.hs|60 col 44-47 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|61 col 44-47 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|62 col 46-49 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|63 col 10-19 warning| Warning: Redundant bracket. Found: (Makeapp) Why not: Makeapp
src/Compiler.hs|64 col 42-45 warning| Warning: Redundant bracket. Found: (i) Why not: i
src/Compiler.hs|65 col 10-18 warning| Warning: Redundant bracket. Found: (Return) Why not: Return
src/Compiler.hs|66 col 10-16 warning| Warning: Redundant bracket. Found: (Halt) Why not: Halt
src/Compiler.hs|67 col 10-18 warning| Warning: Redundant bracket. Found: (Unwind) Why not: Unwind
src/Compiler.hs|68 col 10-16 warning| Warning: Redundant bracket. Found: (Call) Why not: Call
src/Compiler.hs|69 col 44-47 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|70 col 43-46 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|71 col 46-49 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|72 col 10-17 warning| Warning: Redundant bracket. Found: (Alloc) Why not: Alloc
src/Compiler.hs|73 col 46-49 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|74 col 45-48 warning| Warning: Redundant bracket. Found: (a) Why not: a
src/Compiler.hs|82 col 45-76 info| Suggestion: Redundant bracket. Found: (getHeapmaxfuncnamelength heap) + (getHeapmaxaritylength heap) Why not: getHeapmaxfuncnamelength heap + (getHeapmaxaritylength heap)
src/Compiler.hs|83 col 13-41 info| Suggestion: Redundant bracket. Found: (getHeapmaxfuncnamelength heap) + (getHeapmaxaritylength heap) Why not: (getHeapmaxfuncnamelength heap) + getHeapmaxaritylength heap
src/Compiler.hs|83 col 44-75 info| Suggestion: Redundant bracket. Found: (getHeapmaxfuncnamelength heap) + (getHeapmaxaritylength heap) + (getHeapmaxcodeaddrlength heap) Why not: (getHeapmaxfuncnamelength heap) + (getHeapmaxaritylength heap) + getHeapmaxcodeaddrlength heap
src/Compiler.hs|86-87 col 58-20 info| Suggestion: Redundant bracket. Found: (getGlobalmaxheapaddrlength global) + (getGlobalmaxfuncnamelength global) Why not: getGlobalmaxheapaddrlength global + (getGlobalmaxfuncnamelength global)
src/Compiler.hs|87 col 23-58 info| Suggestion: Redundant bracket. Found: (getGlobalmaxheapaddrlength global) + (getGlobalmaxfuncnamelength global) Why not: (getGlobalmaxheapaddrlength global) + getGlobalmaxfuncnamelength global
src/Compiler.hs|172 col 46-76 info| Suggestion: Use infix. Found: elem param (map fst paramList) Why not: param `elem` map fst paramList
src/Compiler.hs|187 col 36-46 warning| Warning: Redundant bracket. Found: (funktrec) Why not: funktrec
src/Compiler.hs|235 col 37-44 info| Suggestion: Redundant bracket. Found: (fst x) == param Why not: fst x == param
src/Compiler.hs|252 col 108-167 warning| Warning: Redundant bracket. Found: ("Compiler Error: No Arguments for Main Function allowed.") Why not: "Compiler Error: No Arguments for Main Function allowed."
src/Compiler.hs|253 col 109-152 warning| Warning: Redundant bracket. Found: ("Compiler Error: No Main Function given.") Why not: "Compiler Error: No Main Function given."
src/Compiler.hs|255 col 111-156 info| Suggestion: Redundant bracket. Found: if (arity == length (takeWhile (== Makeapp) xs)) then checkExecutionErrors refcode (State (pc, xs, stack, heap, global)) else Just ("Compiler Error: Wrong number of Arguments given to " ++ funcname ++ findErrorLocation ((length refcode) - (length xs)) "" heap ++ ".") Why not: if arity == length (takeWhile (== Makeapp) xs) then checkExecutionErrors refcode (State (pc, xs, stack, heap, global)) else Just ("Compiler Error: Wrong number of Arguments given to " ++ funcname ++ findErrorLocation ((length refcode) - (length xs)) "" heap ++ ".")
src/Compiler.hs|257 col 212-228 info| Suggestion: Redundant bracket. Found: (length refcode) - (length xs) Why not: length refcode - (length xs)
src/Compiler.hs|257 col 231-242 info| Suggestion: Redundant bracket. Found: (length refcode) - (length xs) Why not: (length refcode) - length xs
src/Compiler.hs|258 col 194-210 info| Suggestion: Redundant bracket. Found: (length refcode) - (length xs) Why not: length refcode - (length xs)
src/Compiler.hs|258 col 213-224 info| Suggestion: Redundant bracket. Found: (length refcode) - (length xs) Why not: (length refcode) - length xs
src/Compiler.hs|272 col 42-67 info| Suggestion: Use list literal pattern. Found: ((DEF funcname _ pos) : []) Why not: [(DEF funcname _ pos)]
src/Compiler.hs|285 col 26-38 warning| Warning: Redundant bracket. Found: (codelength) Why not: codelength
src/Compiler.hs|285 col 65-71 warning| Warning: Redundant bracket. Found: (code) Why not: code
src/Compiler.hs|289 col 26-38 warning| Warning: Redundant bracket. Found: (codelength) Why not: codelength
src/Compiler.hs|289 col 66-72 warning| Warning: Redundant bracket. Found: (code) Why not: code
src/Compiler.hs|293 col 26-38 warning| Warning: Redundant bracket. Found: (codelength) Why not: codelength
src/Compiler.hs|293 col 66-72 warning| Warning: Redundant bracket. Found: (code) Why not: code
src/Compiler.hs|299 col 35-47 warning| Warning: Redundant bracket. Found: (codelength) Why not: codelength
src/Compiler.hs|299 col 73-77 warning| Warning: Redundant bracket. Found: (pc) Why not: pc
src/Compiler.hs|299 col 93-99 warning| Warning: Redundant bracket. Found: (code) Why not: code
src/Compiler.hs|301 col 35-47 warning| Warning: Redundant bracket. Found: (codelength) Why not: codelength
src/Compiler.hs|301 col 73-77 warning| Warning: Redundant bracket. Found: (pc) Why not: pc
src/Compiler.hs|301 col 93-99 warning| Warning: Redundant bracket. Found: (code) Why not: code
src/Compiler.hs|316 col 9-57 info| Suggestion: Redundant bracket. Found: "|\n" ++ (showHeap heaps maxfuncname maxarity maxcodaddr) Why not: "|\n" ++ showHeap heaps maxfuncname maxarity maxcodaddr
src/Compiler.hs|351 col 5-49 info| Suggestion: Redundant bracket. Found: "|\n" ++ (showGlobal globals maxfuncname maxheapaddr) Why not: "|\n" ++ showGlobal globals maxfuncname maxheapaddr
src/Compiler.hs|355-357 col 1-34 info| Suggestion: Use foldr. Found: getGlobalmaxfuncnamelength (global : globals) = max (length (fst global)) (getGlobalmaxfuncnamelength globals) getGlobalmaxfuncnamelength [] = 0 Why not: getGlobalmaxfuncnamelength globals = foldr (max . length . fst) 0 globals
src/Compiler.hs|360-362 col 1-34 info| Suggestion: Use foldr. Found: getGlobalmaxheapaddrlength (global : globals) = max (length (show (snd global))) (getGlobalmaxheapaddrlength globals) getGlobalmaxheapaddrlength [] = 0 Why not: getGlobalmaxheapaddrlength globals = foldr (max . length . show . snd) 0 globals