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

Add Sound.Tidal.Boot module with standard aliases #1007

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

ejconlon
Copy link
Contributor

@ejconlon ejconlon commented Apr 25, 2023

Addresses #954 . This PR moves most of the content of the default BootTidal.hs file into the library module Sound.Tidal.Boot. This allows us to add Haddock documentation to the standard aliases that can be viewed on Hackage. These aliases can also be looked up on Hoogle. We also add few brief comments to the boot file.

The aliases in the original boot file were essentially partial applications of library functions with some in-scope tidal :: Stream value that is initialized at the top of the file. In this PR, we use a nullary typeclass class Tidally where tidal :: Stream with an orphan instance in the boot file instance Tidally where tidal = tidalInst to pass the reference to the stream to the alias functions, each of which has a Tidally constraint.

I have tested this PR manually. Please review for completeness of aliases and documentation, and maybe kick the tires yourself. I added an example.tidal file to the root of the repo for easy manual IDE integration testing, but please let me know if there is a better way.

@yaxu
Copy link
Member

yaxu commented Apr 26, 2023

Thanks! This is a bit delicate as editors have their own BootTidal.hs file that they use in some circumstances. I guess the old style BootTidal.hs will still work though?

@Zalastax
Copy link
Collaborator

Yes @yaxu, it will continue to work. Nothing used in the custom BootTidal.hs files are modified here. We're only adding a module and changing the default BootTidal.hs

@yaxu
Copy link
Member

yaxu commented Apr 26, 2023

Great, well the main branch is currently in a very 'experimental' state, so lets merge for now, and refine later if needed. Thanks a lot @ejconlon !

@yaxu yaxu merged commit 7c04314 into tidalcycles:main Apr 26, 2023
@ejconlon ejconlon deleted the ejconlon/boot branch April 26, 2023 16:53
@ejconlon
Copy link
Contributor Author

@yaxu Please let me know if there is anything more I can do to refine main for release.

@yaxu
Copy link
Member

yaxu commented Apr 28, 2023

@ejconlon thanks, the big change now on main is moving things around to make room for a new 'sequence' type for beat-oriented representation that is dual to the current cycle-oriented one. I'm currently rewriting Sequence.hs for clarity but hopefully will be ready for testing and polishing soon..

@jwaldmann
Copy link
Contributor

Hi. I am both delighted and shocked that this works. This is ghci providing "local instances"? your

tidalInst <- mkTidal mkTarget mkConfig
instance Tidally where tidal = tidalInst

is morally equivalent to

do
  tidalInst <- mkTidal mkTarget mkConfig
  instance Tidally where tidal = tidalInst

which ghc rejects strongly ...

Having haddocks for names that are being used in Tidal's ghci session is very very good, I will definitely use this when teaching.

@ejconlon
Copy link
Contributor Author

@jwaldmann I am also surprised that it works! At first I tried implicit params, which seemed like a more "principled" approach that follows the usual scoping rules, but ghci did not support it well enough to use.

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.

4 participants