Skip to content

Generics, take 2 #50

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
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Generics, take 2 #50

wants to merge 4 commits into from

Conversation

nc6
Copy link
Collaborator

@nc6 nc6 commented Jan 20, 2025

This commit adds an alternative attempt at generics. It has both advantages and disadvantages.

The principal advantage is that it really allows generics to work with HuddleM - see the example in example/Monad.hs for a demonstration. The previous way of writing this was quite horrible.

There are two main disadvantages:

  • Now, rather than treating a generic function as a regular Haskell function, we have to treat it specially and call it with the special syntax (<--).
  • Only one generic parameter is supported. We can potentially fix this, but it's always going to play unkindly with the (<--) syntax. That having been said, we had only implemented up to two parameters before.

For these reasons, these new-style generics are currently implemented alongside the existing ones for consideration.

@nc6 nc6 mentioned this pull request Jan 20, 2025
@nc6 nc6 force-pushed the nc/generics-redux branch from f553d4e to fb69f97 Compare January 20, 2025 16:54
@Soupstraw Soupstraw force-pushed the master branch 2 times, most recently from 200c0f4 to 6a4b295 Compare March 27, 2025 16:21
nc6 added 2 commits April 14, 2025 16:46
This commit adds an alternative attempt at generics. It has both
advantages and disadvantages.

The principal advantage is that it really allows generics to work with
HuddleM - see the example in example/Monad.hs for a demonstration. The
previous way of writing this was quite horrible.

There are two main disadvantages:

- Now, rather than treating a generic function as a regular Haskell
function, we have to treat it specially and call it with the special
syntax (<--).
- Only one generic parameter is supported. We can potentially fix this,
but it's always going to play unkindly with the (<--) syntax. That
having been said, we had only implemented up to two parameters before.

For these reasons, these new-style generics are currently implemented
alongside the existing ones for consideration.
NE.singleton doesn't exist until a later version of base.
@Soupstraw Soupstraw force-pushed the nc/generics-redux branch 2 times, most recently from f729f30 to 0603fb5 Compare April 14, 2025 13:54
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 this pull request may close these issues.

2 participants