We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I couldn't find an equivalent to biplate which just traverses the immediate children.
class Biplate s a where biplate :: Traversal' s a instance HasTypesUsing (BiplateT s a) s s a a => Biplate s a where biplate f = typesUsing @(BiplateT s a) @a @s f data BiplateT b c type instance Children (BiplateT b c) a = ChildrenBiplate a b c type family ChildrenBiplate (a :: Type) b c where ChildrenBiplate a a c = '[c] ChildrenBiplate a b c = '[] -- example application to VisObject from vis / not-gloss which has Generic but not Data buildBottom :: VisObject Double buildBottom = Quad 0 (V3 220 0 0) (V3 220 220 0) (V3 0 220 0) white -- | >>> buildTop -- Quad (V3 0.0 0.0 280.0) (V3 220.0 0.0 280.0) (V3 220.0 220.0 280.0) (V3 0.0 220.0 280.0) (RGBA 1.0 1.0 1.0 1.0 -- here types doesn't work because a deep traversal of VisObject needs missing Generic instances buildTop = buildBottom & biplate @_ @(V3 Double) . _3 .~ 280
Unusually, typesUsing puts the a parameter before the s. If we follow that convention instead, the expression could be biplate @(V3 Double).
typesUsing
a
s
biplate @(V3 Double)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I couldn't find an equivalent to biplate which just traverses the immediate children.
Unusually,
typesUsing
puts thea
parameter before thes
. If we follow that convention instead, the expression could bebiplate @(V3 Double)
.The text was updated successfully, but these errors were encountered: