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

Anamorphisms #5

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Anamorphisms #5

wants to merge 7 commits into from

Conversation

nomicflux
Copy link
Contributor

Intended as a branch PR, since it provides it provides a couple ideas for dealing with anamorphisms.

Having a Coalgebra<Lazy<A>, Functor<Lazy<A>, F> doesn't prevent stack overflows. The base Anamorphism class then does away with the Lazy requirement altogether, as it doesn't seem to add anything.

Two approaches so far have succeeded in providing (infinite) anamorphisms without stack overflow. The first was a ComposeF which would bind together the functor F and Lazy, but type inference was terrible (requiring multiple explicit casts to start retrieving any results). A FixLazy which required a Fn0<Unfixed> to create a Lazy<Unfixed> also achieved the same results, with better (though still not great) type inference, and again without requiring the user to supply any Lazy annotations. LazyAnamorphism uses this approach.

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.

None yet

1 participant