Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

instance Vector for strict tuples #41

Open
Bodigrim opened this issue Jun 10, 2023 · 1 comment
Open

instance Vector for strict tuples #41

Bodigrim opened this issue Jun 10, 2023 · 1 comment

Comments

@Bodigrim
Copy link
Contributor

What would be the right place for something like this?

import qualified Data.Vector.Generic as G
import qualified Data.Vector.Generic.Mutable as MG
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as MU

newtype instance U.MVector s (Strict.Pair a b) = MV_StrictPair (U.MVector s (a, b))
newtype instance U.Vector    (Strict.Pair a b) = V_StrictPair  (U.Vector    (a, b))
instance U.IsoUnbox (Strict.Pair a b) (a, b)
deriving via (Strict.Pair a b `U.As` (a, b)) instance (U.Unbox a, U.Unbox b)
  => MG.MVector U.MVector (Strict.Pair a b)
deriving via (Strict.Pair a b `U.As` (a, b)) instance (U.Unbox a, U.Unbox b)
  => G.Vector  U.Vector  (Strict.Pair a b)
instance (U.Unbox a, U.Unbox b) => U.Unbox (Strict.Pair a b)

A new micro package?

@phadej
Copy link
Contributor

phadej commented Jun 11, 2023

A new micro package?

Probably. I don't see anything particularly strict here. Or maybe even just put that in vector.

EDIT: If first strict pair needs to be added to base, so be it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants