-
Notifications
You must be signed in to change notification settings - Fork 108
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
Can't write a prepend / concatenate function #143
Comments
I'd say that the sum-type based implementation is the one I'd go with. We even have an example for that in The implementation of sum types is a little bit incomplete, but your program fails only because The bad error message is likely due to the type-class membership checking being busted after the recent "dependenter" refactor. cc @dougalm |
Ok, I've just pushed a commit that should get your approach C to work. I'm getting this now: s3 = prependC blank l
s3
> [0@(Fin 4), 3@(Fin 4), 2@(Fin 4), 3@(Fin 4), 2@(Fin 4)]@(Unit | (Fin 4))
|
Wow, thanks for the quick turnaround! I'll give it a try. |
That works, thanks! But prepending to a product type gives another crash.
The last line crashes with Promisingly, if we put those last two lines into a function, it at least pass the type checker:
FYI, this function is for the CTC loss, where you need to preprocess "text" to " t e x t " to allow for pauses between sounds. |
Should be fixed now! |
Works now, thanks! I'm impressed with the type system. When I started writing |
I'm trying to prepend an element to sequence in such a way that I can iterate over them together, but
Approach A: using product types
So far so good! But I don't know how to iterate over this whole collection with a flat for loop:
Approach B: using dependent types
which gives:
Approach C: using sum types
I tried
crashed with
The text was updated successfully, but these errors were encountered: