Content-Length: 222892 | pFad | http://github.com/purescript-halogen/purescript-halogen/issues/823

90 The Component type should have role annotations · Issue #823 · purescript-halogen/purescript-halogen · GitHub
Skip to content

The Component type should have role annotations #823

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

Open
MonaMayrhofer opened this issue Feb 14, 2024 · 0 comments · May be fixed by #824
Open

The Component type should have role annotations #823

MonaMayrhofer opened this issue Feb 14, 2024 · 0 comments · May be fixed by #824

Comments

@MonaMayrhofer
Copy link
Contributor

MonaMayrhofer commented Feb 14, 2024

Currently the Component type does not have any role annotations

data Component
(query :: Type -> Type)
(input :: Type)
(output :: Type)
(m :: Type -> Type)

This results in weird, and definitely unsound, things like these to pass the typechecker (note that these are coerce and not unsafeCoerce):

doBadThings :: forall q i o m. Monad m => H.Component q i o Maybe -> H.Component q i o Aff
doBadThings component = coerce component

doEvilThings :: forall q i o m. Monad m => H.Component q i o Effect -> H.Component q i o Aff
doEvilThings component = coerce component

doUglyThings :: forall q i o m. Monad m => H.Component q i o (ReaderT Int m) -> H.Component q i o (ReaderT String m)
doUglyThings component = coerce component

From what I understood, I think that that all of the parameters should have a representational role, however I am not 100% sure and someone who has a bit more experience and insight into Halogen should give that a second thought.

type role Component representational representational representational representational

Some Relevant examples on Try Purescript

IMO, This is especially important as coercing components is advertised in the Halogen Real World example:

https://github.com/thomashoneyman/purescript-halogen-realworld/blob/ab13d62f95f4eb3ca589c0f043fe415af8408ff9/src/AppM.purs#L86-L87

@garyb garyb linked a pull request Feb 20, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/purescript-halogen/purescript-halogen/issues/823

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy