simmsb / calamity

A library for writing discord bots in haskell
https://hackage.haskell.org/package/calamity
MIT License
109 stars 11 forks source link

No way to upgrade Snowflake VoiceChannel to VoiceChannel #37

Closed Innf107 closed 3 years ago

Innf107 commented 3 years ago

It seens like it's currently impossible to upgrade Snowflake VoiceChannel to VoiceChannel. Sorry, if I just missed the intended solution. My workaround so far was to create my own orphan instance

instance Upgradeable VoiceChannel (Snowflake VoiceChannel) where
    upgrade s = upgrade (coerceSnowflake @_ @Channel s) <&> \case
            Just (GuildChannel' (GuildVoiceChannel vc)) -> Just vc
            _ -> Nothing
simmsb commented 3 years ago

Yeah the current way is probably to do that, adding Upgradeable instances for all the channel types would definitely be useful though