prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  If parse_literal is not present try fallbacking to `parse_value(ast.value)`
  Following idea was brought up in discussion for #24:
  
  > Maybe we could default to calling parse_value with ast.value when only one function is provided?
  
  This requires further study. `IntValue`, `StringValue` and friends are obvious to deal with, but but complex types like `ListValue` may require some extra unpacking magic.
  
  Still, if it is possible to pull off, it could be an excellent convenience for developers creating custom scalars, saving the need for potentially maintaining two very simiiar implementations, one doing `isinstance(value, basestr)` and other `isinstance(value, StringValue)`.
  
  </issue>
  <code>
  [start of ariadne/scalars.py]
  1 from typing import Optional, cast
  2 
  3 from graphql.type import (
  4     GraphQLNamedType,
  5     GraphQLScalarLiteralParser,
  6     GraphQLScalarSerializer,
  7     GraphQLScalarType,
  8     GraphQLScalarValueParser,
  9     GraphQLSchema,
  10 )
  11 
  12 from .types import SchemaBindable
  13 
  14 
  15 class ScalarType(SchemaBindable):
  16     _serialize: Optional[GraphQLScalarSerializer]
  17     _parse_value: Optional[GraphQLScalarValueParser]
  18     _parse_literal: Optional[GraphQLScalarLiteralParser]
  19 
  20     def __init__(
  21         self,
  22         name: str,
  23         *,
  24         serializer: GraphQLScalarSerializer = None,
  25         value_parser: GraphQLScalarValueParser = None,
  26         literal_parser: GraphQLScalarLiteralParser = None,
  27     ) -> None:
  28         self.name = name
  29         self._serialize = serializer
  30         self._parse_value = value_parser
  31         self._parse_literal = literal_parser
  32 
  33     def set_serializer(self, f: GraphQLScalarSerializer) -> GraphQLScalarSerializer:
  34         self._serialize = f
  35         return f
  36 
  37     def set_value_parser(self, f: GraphQLScalarValueParser) -> GraphQLScalarValueParser:
  38         self._parse_value = f
  39         return f
  40 
  41     def set_literal_parser(
  42         self, f: GraphQLScalarLiteralParser
  43     ) -> GraphQLScalarLiteralParser:
  44         self._parse_literal = f
  45         return f
  46 
  47     # Alias above setters for consistent decorator API
  48     serializer = set_serializer
  49     value_parser = set_value_parser
  50     literal_parser = set_literal_parser
  51 
  52     def bind_to_schema(self, schema: GraphQLSchema) -> None:
  53         graphql_type = schema.type_map.get(self.name)
  54         self.validate_graphql_type(graphql_type)
  55         graphql_type = cast(GraphQLScalarType, graphql_type)
  56 
  57         if self._serialize:
  58             # See mypy bug https://github.com/python/mypy/issues/2427
  59             graphql_type.serialize = self._serialize  # type: ignore
  60         if self._parse_value:
  61             graphql_type.parse_value = self._parse_value
  62         if self._parse_literal:
  63             graphql_type.parse_literal = self._parse_literal
  64 
  65     def validate_graphql_type(self, graphql_type: Optional[GraphQLNamedType]) -> None:
  66         if not graphql_type:
  67             raise ValueError("Scalar %s is not defined in the schema" % self.name)
  68         if not isinstance(graphql_type, GraphQLScalarType):
  69             raise ValueError(
  70                 "%s is defined in the schema, but it is instance of %s (expected %s)"
  71                 % (self.name, type(graphql_type).__name__, GraphQLScalarType.__name__)
  72             )
  73
  [end of ariadne/scalars.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/ariadne/scalars.py b/ariadne/scalars.py
  --- a/ariadne/scalars.py
  +++ b/ariadne/scalars.py
  @@ -1,5 +1,11 @@
   from typing import Optional, cast
   
  +from graphql.language.ast import (
  +    BooleanValueNode,
  +    FloatValueNode,
  +    IntValueNode,
  +    StringValueNode,
  +)
   from graphql.type import (
       GraphQLNamedType,
       GraphQLScalarLiteralParser,
  @@ -36,6 +42,8 @@
   
       def set_value_parser(self, f: GraphQLScalarValueParser) -> GraphQLScalarValueParser:
           self._parse_value = f
  +        if not self._parse_literal:
  +            self._parse_literal = create_default_literal_parser(f)
           return f
   
       def set_literal_parser(
  @@ -70,3 +78,15 @@
                   "%s is defined in the schema, but it is instance of %s (expected %s)"
                   % (self.name, type(graphql_type).__name__, GraphQLScalarType.__name__)
               )
  +
  +
  +SCALAR_AST_NODES = (BooleanValueNode, FloatValueNode, IntValueNode, StringValueNode)
  +
  +
  +def create_default_literal_parser(
  +    value_parser: GraphQLScalarValueParser
  +) -> GraphQLScalarLiteralParser:
  +    def default_literal_parser(ast):
  +        return value_parser(ast.value)
  +
  +    return default_literal_parser
  
verification_info: {"golden_diff": "diff --git a/ariadne/scalars.py b/ariadne/scalars.py\n--- a/ariadne/scalars.py\n+++ b/ariadne/scalars.py\n@@ -1,5 +1,11 @@\n from typing import Optional, cast\n \n+from graphql.language.ast import (\n+    BooleanValueNode,\n+    FloatValueNode,\n+    IntValueNode,\n+    StringValueNode,\n+)\n from graphql.type import (\n     GraphQLNamedType,\n     GraphQLScalarLiteralParser,\n@@ -36,6 +42,8 @@\n \n     def set_value_parser(self, f: GraphQLScalarValueParser) -> GraphQLScalarValueParser:\n         self._parse_value = f\n+        if not self._parse_literal:\n+            self._parse_literal = create_default_literal_parser(f)\n         return f\n \n     def set_literal_parser(\n@@ -70,3 +78,15 @@\n                 \"%s is defined in the schema, but it is instance of %s (expected %s)\"\n                 % (self.name, type(graphql_type).__name__, GraphQLScalarType.__name__)\n             )\n+\n+\n+SCALAR_AST_NODES = (BooleanValueNode, FloatValueNode, IntValueNode, StringValueNode)\n+\n+\n+def create_default_literal_parser(\n+    value_parser: GraphQLScalarValueParser\n+) -> GraphQLScalarLiteralParser:\n+    def default_literal_parser(ast):\n+        return value_parser(ast.value)\n+\n+    return default_literal_parser\n", "issue": "If parse_literal is not present try fallbacking to `parse_value(ast.value)`\nFollowing idea was brought up in discussion for #24:\r\n\r\n> Maybe we could default to calling parse_value with ast.value when only one function is provided?\r\n\r\nThis requires further study. `IntValue`, `StringValue` and friends are obvious to deal with, but but complex types like `ListValue` may require some extra unpacking magic.\r\n\r\nStill, if it is possible to pull off, it could be an excellent convenience for developers creating custom scalars, saving the need for potentially maintaining two very simiiar implementations, one doing `isinstance(value, basestr)` and other `isinstance(value, StringValue)`.\n", "before_files": [{"content": "from typing import Optional, cast\n\nfrom graphql.type import (\n    GraphQLNamedType,\n    GraphQLScalarLiteralParser,\n    GraphQLScalarSerializer,\n    GraphQLScalarType,\n    GraphQLScalarValueParser,\n    GraphQLSchema,\n)\n\nfrom .types import SchemaBindable\n\n\nclass ScalarType(SchemaBindable):\n    _serialize: Optional[GraphQLScalarSerializer]\n    _parse_value: Optional[GraphQLScalarValueParser]\n    _parse_literal: Optional[GraphQLScalarLiteralParser]\n\n    def __init__(\n        self,\n        name: str,\n        *,\n        serializer: GraphQLScalarSerializer = None,\n        value_parser: GraphQLScalarValueParser = None,\n        literal_parser: GraphQLScalarLiteralParser = None,\n    ) -> None:\n        self.name = name\n        self._serialize = serializer\n        self._parse_value = value_parser\n        self._parse_literal = literal_parser\n\n    def set_serializer(self, f: GraphQLScalarSerializer) -> GraphQLScalarSerializer:\n        self._serialize = f\n        return f\n\n    def set_value_parser(self, f: GraphQLScalarValueParser) -> GraphQLScalarValueParser:\n        self._parse_value = f\n        return f\n\n    def set_literal_parser(\n        self, f: GraphQLScalarLiteralParser\n    ) -> GraphQLScalarLiteralParser:\n        self._parse_literal = f\n        return f\n\n    # Alias above setters for consistent decorator API\n    serializer = set_serializer\n    value_parser = set_value_parser\n    literal_parser = set_literal_parser\n\n    def bind_to_schema(self, schema: GraphQLSchema) -> None:\n        graphql_type = schema.type_map.get(self.name)\n        self.validate_graphql_type(graphql_type)\n        graphql_type = cast(GraphQLScalarType, graphql_type)\n\n        if self._serialize:\n            # See mypy bug https://github.com/python/mypy/issues/2427\n            graphql_type.serialize = self._serialize  # type: ignore\n        if self._parse_value:\n            graphql_type.parse_value = self._parse_value\n        if self._parse_literal:\n            graphql_type.parse_literal = self._parse_literal\n\n    def validate_graphql_type(self, graphql_type: Optional[GraphQLNamedType]) -> None:\n        if not graphql_type:\n            raise ValueError(\"Scalar %s is not defined in the schema\" % self.name)\n        if not isinstance(graphql_type, GraphQLScalarType):\n            raise ValueError(\n                \"%s is defined in the schema, but it is instance of %s (expected %s)\"\n                % (self.name, type(graphql_type).__name__, GraphQLScalarType.__name__)\n            )\n", "path": "ariadne/scalars.py"}]}