prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  The bear HaskellLintBear raised an exception
  I've used HaskellLintBear to linting https://github.com/wisn/elm-reactor/
  
  Here is the log
  https://travis-ci.org/wisn/elm-reactor/builds/180417562
  
  The build result is green, but the bear HaskellLintBear raised an exception.
  
  It seems HaskellLintBear have a problem
  ```
  [WARNING][14:56:00] Bear HaskellLintBear failed to run. Take a look at debug messages (`-V`) for further information.
  ```
  
  I've collected the traceback information:
  ```
  Traceback (most recent call last):
    File "/coala-bears/bears/haskell/HaskellLintBear.py", line 41, in process_output
      assert issue['startLine'] == issue['endLine']
    AssertionError
  
    File "/coala-bears/bears/haskell/HaskellLintBear.py", line 45, in process_output
      newline = line_to_change.replace(issue['from'], issue['to'])
    TypeError: Can't convert 'NoneType' object to str implicitly
  ```
  
  I think `TypeError: Can't convert 'NoneType' object to str implicitly` is the main problem.
  Then, followed by `AssertionError`.
  
  Unfortunately, I can't trace manually with `hlint` because my PC freezes when compiling (in installing) it. Hope this information will be helpful. Thanks and sorry for my bad English...
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bears/haskell/HaskellLintBear.py`
  Content:
  ```
  1 import json
  2 
  3 from coalib.bearlib.abstractions.Linter import linter
  4 from dependency_management.requirements.DistributionRequirement import (
  5     DistributionRequirement)
  6 from coalib.results.Diff import Diff
  7 from coalib.results.Result import Result
  8 from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
  9 
  10 
  11 @linter(executable='hlint')
  12 class HaskellLintBear:
  13     """
  14     Check Haskell code for possible problems. This bear can propose patches for
  15     using alternative functions, simplifying code and removing redundancies.
  16 
  17     See <http://community.haskell.org/~ndm/darcs/hlint/hlint.htm> for more
  18     information.
  19     """
  20 
  21     LANGUAGES = {'Haskell'}
  22     REQUIREMENTS = {DistributionRequirement(apt_get='hlint')}
  23     AUTHORS = {'The coala developers'}
  24     AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
  25     LICENSE = 'AGPL-3.0'
  26     CAN_DETECT = {'Duplication'}
  27     CAN_FIX = {'Unused Code', 'Code Simplification'}
  28 
  29     severity_map = {'Error': RESULT_SEVERITY.MAJOR,
  30                     'Warning': RESULT_SEVERITY.NORMAL,
  31                     'Suggestion': RESULT_SEVERITY.INFO}
  32 
  33     @staticmethod
  34     def create_arguments(filename, file, config_file):
  35         return '--json', filename
  36 
  37     def process_output(self, output, filename, file):
  38         output = json.loads(output)
  39 
  40         for issue in output:
  41             assert issue['startLine'] == issue['endLine']
  42             diff = Diff(file)
  43             line_nr = issue['startLine']
  44             line_to_change = file[line_nr-1]
  45             newline = line_to_change.replace(issue['from'], issue['to'])
  46             diff.change_line(line_nr, line_to_change, newline)
  47 
  48             yield Result.from_values(
  49                 origin=self,
  50                 message=issue['hint'],
  51                 file=filename,
  52                 severity=self.severity_map[issue['severity']],
  53                 line=issue['startLine'],
  54                 diffs={filename: diff})
  55
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bears/haskell/HaskellLintBear.py b/bears/haskell/HaskellLintBear.py
  --- a/bears/haskell/HaskellLintBear.py
  +++ b/bears/haskell/HaskellLintBear.py
  @@ -38,11 +38,15 @@
           output = json.loads(output)
   
           for issue in output:
  -            assert issue['startLine'] == issue['endLine']
               diff = Diff(file)
  +            from_lines = issue['from'].splitlines()
  +            to_lines = issue['to'].splitlines()
  +            assert len(from_lines) == len(to_lines)
  +            for other_lines in range(1, len(from_lines)):
  +                assert from_lines[other_lines] == to_lines[other_lines]
               line_nr = issue['startLine']
               line_to_change = file[line_nr-1]
  -            newline = line_to_change.replace(issue['from'], issue['to'])
  +            newline = line_to_change.replace(from_lines[0], to_lines[0])
               diff.change_line(line_nr, line_to_change, newline)
   
               yield Result.from_values(
  @@ -51,4 +55,7 @@
                   file=filename,
                   severity=self.severity_map[issue['severity']],
                   line=issue['startLine'],
  +                column=issue['startColumn'],
  +                end_line=issue['endLine'],
  +                end_column=issue['endColumn'],
                   diffs={filename: diff})
  
verification_info: {"golden_diff": "diff --git a/bears/haskell/HaskellLintBear.py b/bears/haskell/HaskellLintBear.py\n--- a/bears/haskell/HaskellLintBear.py\n+++ b/bears/haskell/HaskellLintBear.py\n@@ -38,11 +38,15 @@\n         output = json.loads(output)\n \n         for issue in output:\n-            assert issue['startLine'] == issue['endLine']\n             diff = Diff(file)\n+            from_lines = issue['from'].splitlines()\n+            to_lines = issue['to'].splitlines()\n+            assert len(from_lines) == len(to_lines)\n+            for other_lines in range(1, len(from_lines)):\n+                assert from_lines[other_lines] == to_lines[other_lines]\n             line_nr = issue['startLine']\n             line_to_change = file[line_nr-1]\n-            newline = line_to_change.replace(issue['from'], issue['to'])\n+            newline = line_to_change.replace(from_lines[0], to_lines[0])\n             diff.change_line(line_nr, line_to_change, newline)\n \n             yield Result.from_values(\n@@ -51,4 +55,7 @@\n                 file=filename,\n                 severity=self.severity_map[issue['severity']],\n                 line=issue['startLine'],\n+                column=issue['startColumn'],\n+                end_line=issue['endLine'],\n+                end_column=issue['endColumn'],\n                 diffs={filename: diff})\n", "issue": "The bear HaskellLintBear raised an exception\nI've used HaskellLintBear to linting https://github.com/wisn/elm-reactor/\r\n\r\nHere is the log\r\nhttps://travis-ci.org/wisn/elm-reactor/builds/180417562\r\n\r\nThe build result is green, but the bear HaskellLintBear raised an exception.\r\n\r\nIt seems HaskellLintBear have a problem\r\n```\r\n[WARNING][14:56:00] Bear HaskellLintBear failed to run. Take a look at debug messages (`-V`) for further information.\r\n```\r\n\r\nI've collected the traceback information:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/coala-bears/bears/haskell/HaskellLintBear.py\", line 41, in process_output\r\n    assert issue['startLine'] == issue['endLine']\r\n  AssertionError\r\n\r\n  File \"/coala-bears/bears/haskell/HaskellLintBear.py\", line 45, in process_output\r\n    newline = line_to_change.replace(issue['from'], issue['to'])\r\n  TypeError: Can't convert 'NoneType' object to str implicitly\r\n```\r\n\r\nI think `TypeError: Can't convert 'NoneType' object to str implicitly` is the main problem.\r\nThen, followed by `AssertionError`.\r\n\r\nUnfortunately, I can't trace manually with `hlint` because my PC freezes when compiling (in installing) it. Hope this information will be helpful. Thanks and sorry for my bad English...\n", "before_files": [{"content": "import json\n\nfrom coalib.bearlib.abstractions.Linter import linter\nfrom dependency_management.requirements.DistributionRequirement import (\n    DistributionRequirement)\nfrom coalib.results.Diff import Diff\nfrom coalib.results.Result import Result\nfrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY\n\n\n@linter(executable='hlint')\nclass HaskellLintBear:\n    \"\"\"\n    Check Haskell code for possible problems. This bear can propose patches for\n    using alternative functions, simplifying code and removing redundancies.\n\n    See <http://community.haskell.org/~ndm/darcs/hlint/hlint.htm> for more\n    information.\n    \"\"\"\n\n    LANGUAGES = {'Haskell'}\n    REQUIREMENTS = {DistributionRequirement(apt_get='hlint')}\n    AUTHORS = {'The coala developers'}\n    AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}\n    LICENSE = 'AGPL-3.0'\n    CAN_DETECT = {'Duplication'}\n    CAN_FIX = {'Unused Code', 'Code Simplification'}\n\n    severity_map = {'Error': RESULT_SEVERITY.MAJOR,\n                    'Warning': RESULT_SEVERITY.NORMAL,\n                    'Suggestion': RESULT_SEVERITY.INFO}\n\n    @staticmethod\n    def create_arguments(filename, file, config_file):\n        return '--json', filename\n\n    def process_output(self, output, filename, file):\n        output = json.loads(output)\n\n        for issue in output:\n            assert issue['startLine'] == issue['endLine']\n            diff = Diff(file)\n            line_nr = issue['startLine']\n            line_to_change = file[line_nr-1]\n            newline = line_to_change.replace(issue['from'], issue['to'])\n            diff.change_line(line_nr, line_to_change, newline)\n\n            yield Result.from_values(\n                origin=self,\n                message=issue['hint'],\n                file=filename,\n                severity=self.severity_map[issue['severity']],\n                line=issue['startLine'],\n                diffs={filename: diff})\n", "path": "bears/haskell/HaskellLintBear.py"}], "after_files": [{"content": "import json\n\nfrom coalib.bearlib.abstractions.Linter import linter\nfrom dependency_management.requirements.DistributionRequirement import (\n    DistributionRequirement)\nfrom coalib.results.Diff import Diff\nfrom coalib.results.Result import Result\nfrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY\n\n\n@linter(executable='hlint')\nclass HaskellLintBear:\n    \"\"\"\n    Check Haskell code for possible problems. This bear can propose patches for\n    using alternative functions, simplifying code and removing redundancies.\n\n    See <http://community.haskell.org/~ndm/darcs/hlint/hlint.htm> for more\n    information.\n    \"\"\"\n\n    LANGUAGES = {'Haskell'}\n    REQUIREMENTS = {DistributionRequirement(apt_get='hlint')}\n    AUTHORS = {'The coala developers'}\n    AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}\n    LICENSE = 'AGPL-3.0'\n    CAN_DETECT = {'Duplication'}\n    CAN_FIX = {'Unused Code', 'Code Simplification'}\n\n    severity_map = {'Error': RESULT_SEVERITY.MAJOR,\n                    'Warning': RESULT_SEVERITY.NORMAL,\n                    'Suggestion': RESULT_SEVERITY.INFO}\n\n    @staticmethod\n    def create_arguments(filename, file, config_file):\n        return '--json', filename\n\n    def process_output(self, output, filename, file):\n        output = json.loads(output)\n\n        for issue in output:\n            diff = Diff(file)\n            from_lines = issue['from'].splitlines()\n            to_lines = issue['to'].splitlines()\n            assert len(from_lines) == len(to_lines)\n            for other_lines in range(1, len(from_lines)):\n                assert from_lines[other_lines] == to_lines[other_lines]\n            line_nr = issue['startLine']\n            line_to_change = file[line_nr-1]\n            newline = line_to_change.replace(from_lines[0], to_lines[0])\n            diff.change_line(line_nr, line_to_change, newline)\n\n            yield Result.from_values(\n                origin=self,\n                message=issue['hint'],\n                file=filename,\n                severity=self.severity_map[issue['severity']],\n                line=issue['startLine'],\n                column=issue['startColumn'],\n                end_line=issue['endLine'],\n                end_column=issue['endColumn'],\n                diffs={filename: diff})\n", "path": "bears/haskell/HaskellLintBear.py"}]}