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

Overriding take and drop .. or making a tidal prelude? #1144

Closed
yaxu opened this issue Feb 9, 2025 · 4 comments
Closed

Overriding take and drop .. or making a tidal prelude? #1144

yaxu opened this issue Feb 9, 2025 · 4 comments

Comments

@yaxu
Copy link
Member

yaxu commented Feb 9, 2025

We're already replacing the Haskell prelude's <* and *> operators, and now I'd quite like to replace take and drop with functions that operate on pattern steps rather than lists. At the moment I'm defining steptake and stepdrop, which are just take and drop in strudel.

So it crossed my mind that we could more fully embrace Tidal as a domain specific language, and only import selected functions from the Prelude. (Of course end-user live coders could still explicitly import it all themselves if they wanted.)

But in any case we could hide the prelude's take and drop, in a way that people could still do Prelude.take etc if they wanted. Or is this a bit far for such well-used haskell functions?

Ideally we could make a polymorphic version that works on both patterns and lists, but sadly I think that's not possible as the pattern version will take patterns of rationals, whereas the list version takes plain integers.

@yaxu
Copy link
Member Author

yaxu commented Feb 9, 2025

Relatedly, previously import Prelude hiding ((<*), (*>), all, take ,drop) has been enough for the tidal versions of these functions to be picked, but it isn't working for me, at least in ghc 9.4.8 or 9.12.1. Maybe a regression with the new Sound.Tidal.Boot feature?

@yaxu
Copy link
Member Author

yaxu commented Feb 9, 2025

Relatedly, previously import Prelude hiding ((<*), (*>), all, take ,drop) has been enough for the tidal versions of these functions to be picked, but it isn't working for me, at least in ghc 9.4.8 or 9.12.1. Maybe a regression with the new Sound.Tidal.Boot feature?

It seems the problem I'm having is that import Prelude hiding ... doesn't work in cabal repl, it's fine in ghci. haskell/cabal#10786

@sss-create
Copy link
Collaborator

I have no strong opinion on this.

@yaxu
Copy link
Member Author

yaxu commented Feb 20, 2025

Due to haskell/cabal#10786 , and that cabal repl is one way to get away from difficulties of installing cabal libraries, I think best not to override take/drop for now.

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