# from collections.abc import Callable

# from coolqlite._common import SqliteType


# type UserFunction = Callable[..., SqliteType]


# def foo(x: SqliteType) -> int:
#     if not isinstance(x, int):
#         raise TypeError("oops")
#     return x


# def takes_user_fn(fn: UserFunction):
#     pass


# takes_user_fn(foo)

# import sqlite3 as sql3

# db = sql3.connect(":memory:")
# db.create_function()

# TODO: FOR USER FUNCTIONS
# need to enable passing exceptions upwards, apparently?
# why isn't that the default?
# there was some discussion about it.
# https://discuss.python.org/t/enable-unraisable-exceptions-by-default-for-sqlite3-callbacks/43808/20

# TODO: preprocess functions to validate the signature makes sense.
# maybe we need a connection preparer???
