Skip to content

Instantly share code, notes, and snippets.

@lally
Created June 24, 2020 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lally/e6b08651fcb0760de414ff058db373d2 to your computer and use it in GitHub Desktop.
Save lally/e6b08651fcb0760de414ff058db373d2 to your computer and use it in GitHub Desktop.
Ambiguous api0 with api
class QueryResult api where
type Query api :: *
addContinue :: Maybe KM.Continue -> Query api -> Query api
setupWithLimit :: CloudConfig -> Maybe Int -> Query api -> Query api
{-
cloud-analyzer> • Couldn't match type ‘Query api0’ with ‘Query api’
cloud-analyzer> Expected type: Maybe KM.Continue -> Query api -> Query api
cloud-analyzer> Actual type: Maybe KM.Continue -> Query api0 -> Query api0
cloud-analyzer> NB: ‘Query’ is a non-injective type family
cloud-analyzer> The type variable ‘api0’ is ambiguous
cloud-analyzer> • In the ambiguity check for ‘addContinue’
cloud-analyzer> To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
cloud-analyzer> When checking the class method:
cloud-analyzer> addContinue :: forall api.
cloud-analyzer> QueryResult api =>
cloud-analyzer> Maybe KM.Continue -> Query api -> Query api
cloud-analyzer> In the class declaration for ‘QueryResult’
cloud-analyzer> |
cloud-analyzer> 155 | addContinue :: Maybe KM.Continue -> Query api -> Query api
cloud-analyzer> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment