Grain Futures Act
Grain Futures Act : Comprendre les bases pour le trading de contrats à terme crypto
Le Grain Futures Act (Loi sur les contrats à terme sur les grains) est une législation historique qui a jet# An experiment with `scala.quoted` type level programming features
This repository contains an experiment to get familiar with `scala.quoted` (and in particular the type level programming features) and to see how far we can get with the current features.
It is a companion repository of the blog post [Type-level programming in Scala 3](https://blog.softwaremill.com/type-level-programming-in-scala-3-3d41753d5051).
- Context
Let's say we want to define a type-level function that operates on a tuple. In our example, we want to reverse the elements of a tuple, such that `Reverse(a *: b *: EmptyTuple]` should give us `b *: a *: EmptyTuple`.
- Running the code
You can run the code in the sbt REPL by running:
```bash sbt console ```
Then you can experiment with the code by running the following commands:
```scala import io.scalaland.workout.TypeLevelTupleReverse._
// The following should work summon[Reverse[(1, 2)] =:= (2, 1)] summon[Reverse[(1, 2, 3)] =:= (3, 2, 1)] summon[Reverse[(1, 2, 3, 4)] =:= (4, 3, 2, 1)]
// The following should not compile summon[Reverse[(1, 2)] =:= (1, 2)] summon[Reverse[(1, 2, 3)] =:= (1, 2, 3)] summon[Reverse[(1, 2, 3, 4)] =:= (1, 2, 3, 4)] ```
- Problems with the current implementation
Currently, the implementation does not work with nested tuples. For example, `Reverse[(1, (2, 3))]` should give us `((3, 2), 1)`, but it currently gives us `((2, 3), 1)`. This is because the current implementation does not recursively reverse the elements of the tuple.
- Conclusion
This experiment shows that `scala.quoted` is a powerful tool for type-level programming. However, it also shows that there are still some limitations to the current features. In particular, the lack of support for `match types` makes it difficult to implement recursive type-level functions. I hope that this experiment will help to identify the limitations of the current features and to motivate the development of new features in the future.
Plateformes de trading de contrats à terme recommandées
Plateforme | Caractéristiques des contrats à terme | Inscription |
---|---|---|
Binance Futures | Effet de levier jusqu'à 125x, contrats USDⓈ-M | Inscrivez-vous maintenant |
Bybit Futures | Contrats perpétuels inversés | Commencer à trader |
BingX Futures | Trading par copie pour les contrats à terme | Rejoignez BingX |
Bitget Futures | Contrats avec marge USDT | Ouvrir un compte |
Rejoignez la communauté
Abonnez-vous à la chaîne Telegram @strategybin pour plus d'informations. La plateforme crypto la plus rentable - inscrivez-vous ici.
Participez à notre communauté
Abonnez-vous à la chaîne Telegram @cryptofuturestrading pour des analyses, des signaux gratuits et bien plus encore !