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

Not an issue - just a question about the haskell type system that came to my mind by looking at data-fix #24

Closed
alaendle opened this issue Jan 11, 2024 · 2 comments

Comments

@alaendle
Copy link

Please excuse if this is a dumb question 😃

Maybe I just missing some special Haskell syntax - but I don't find a good explanation for:

type MyMaybe :: Type -> Type
type MyMaybe = Maybe

type MyMaybe' :: Type -> Type
type MyMaybe' a = Maybe a

type Works = Fix MyMaybe

-- • The type synonym ‘MyMaybe'’ should have 1 argument, but has been given none
-- • In the type synonym declaration for ‘DoesntWork’
type DoesntWork = Fix MyMaybe'

Here for sure the argument can be avoided - but what if the type is nested - e.g. something like Either (Maybe a ) ()? How to apply Fix in such a case?

@anton-k
Copy link
Contributor

anton-k commented Jan 11, 2024

In Haskell we can not use type-synonyms as functions from type to type. A type synonym should always be fully applied.
You can solve it by declaring the new datatype (using data or newtype).

@anton-k anton-k closed this as completed Jan 11, 2024
@alaendle
Copy link
Author

Thanks!

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