Skip to content

Instantly share code, notes, and snippets.

@dminuoso

dminuoso/err Secret

Last active December 8, 2021 14:50
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 dminuoso/7ca1d473e20c70b1ddb98fc714f4391c to your computer and use it in GitHub Desktop.
Save dminuoso/7ca1d473e20c70b1ddb98fc714f4391c to your computer and use it in GitHub Desktop.
• Couldn't match type ‘Inner mode [Authorization tok pat]’
with ‘Inner mode [Authorization tok pat0]’
Expected type: PermsF mode -> Inner mode [Authorization tok pat0]
Actual type: PermsF mode -> Inner mode [Authorization tok pat]
NB: ‘Inner’ is a non-injective type family
The type variable ‘pat0’ is ambiguous
• In the ambiguity check for ‘hasPerm’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature:
hasPerm :: User -> PermSelector tok pat -> T.Text -> GerdM tok
data Mode = Field | Descr
type family Inner tag field where
Inner Field f = Maybe f
Inner Descr f = T.Text
type PermSelector tok pat = forall mode. PermsF mode -> Inner mode [Authorization tok pat]
hasPerm :: User -> PermSelector tok pat -> T.Text -> GerdM tok
hasPerm = ...
data PermsF f = PermsF
{ permApiVersions :: Inner f [SimpleAuthorization]
, permServerList :: Inner f [Authorization'']
, permServerView :: Inner f [Authorization'']
, permSearch :: Inner f [Authorization'']
, permFlushCache :: Inner f [Authorization'']
, permStatistics :: Inner f [Authorization'']
, permZoneCreate :: Inner f [Authorization'']
, permZoneList :: Inner f [Authorization Filtered DomPat]
, permZoneView :: Inner f [Authorization Filtered DomPat]
, permZoneUpdate :: Inner f [Authorization' DomPat]
, permZoneUpdateRecords :: Inner f [Authorization DomTyPat DomPat]
, permZoneDelete :: Inner f [Authorization' DomPat]
, permZoneTriggerAxfr :: Inner f [Authorization' DomPat]
, permZoneGetAxfr :: Inner f [Authorization' DomPat]
, permZoneNotifySlaves :: Inner f [Authorization' DomPat]
, permZoneRectify :: Inner f [Authorization' DomPat]
, permZoneMetadata :: Inner f [Authorization' DomPat]
, permZoneCryptokeys :: Inner f [Authorization' DomPat]
, permTSIGKeyList :: Inner f [Authorization'']
, permTSIGKeyCreate :: Inner f [Authorization'']
, permTSIGKeyView :: Inner f [Authorization'']
, permTSIGKeyUpdate :: Inner f [Authorization'']
, permTSIGKeyDelete :: Inner f [Authorization'']
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment