Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Re-export SNat from base #2783

Open
martijnbastiaan opened this issue Aug 6, 2024 · 0 comments
Open

Re-export SNat from base #2783

martijnbastiaan opened this issue Aug 6, 2024 · 0 comments

Comments

@martijnbastiaan
Copy link
Member

SNat is part of base-4.18.0.0 and later. Up to this point, we've defined our own version:

data SNat (n :: Nat) where
  SNat :: KnownNat n => SNat n

base's version is a bit more complex:

newtype SNat (n :: Nat) = UnsafeSNat Natural
type role SNat nominal

pattern SNat :: forall n. () => KnownNat n => SNat n
pattern SNat <- (knownNatInstance -> KnownNatInstance)
  where SNat = natSing
{-# COMPLETE SNat #-}

data KnownNatInstance (n :: Nat) where
  KnownNatInstance :: KnownNat n => KnownNatInstance n

knownNatInstance :: SNat n -> KnownNatInstance n
knownNatInstance sn = withKnownNat sn KnownNatInstance

Could we re-export for newer bases and expect everything to JustWork(tm)?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant