Skip to content

Conversation

@Dev-CodeBox
Copy link
Contributor

This PR adds a new section Higher-Kinded Types to the Scala 2 Tour documentation.

It includes:

  • Higher-Kinded Types (HKT) with Functor example
  • Type Bounds (upper/lower) with sample code
  • Type Projections with example classes

This addresses issue #1269 and provides simple explanations and examples for learners.

@eed3si9n
Copy link
Member

Note that in scala/scala#5916 I've added some help message to repl :kind command, including the explanation of a proper type, a type constructor, and HKT. Also you can pass in -v to the :kind command to get English description of the kind in Scala 2.13:

scala> :k -v Option[Int]
Option[Int]'s kind is A
*
This is a proper type.

scala> :k -v Option
Option's kind is F[+A]
* -(+)-> *
This is a type constructor: a 1st-order-kinded type.

scala> trait ~>[-F1[_], +F2[_]] {}
trait $tilde$greater

scala> :kind -v ~>
~>'s kind is X[-F1[A1],+F2[A2]]
(* -> *) -(-)-> (* -> *) -(+)-> *
This is a type constructor that takes type constructor(s): a higher-kinded type.

---
layout: multipage-overview
title: Advanced Type Features
partof: scaladoc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this in the Scaladoc guide and not Tour of Scala?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! You're right, this should be part of the Tour of Scala, not Scaladoc.
I’ll move the content under _tour and update the layout accordingly.

@WojciechMazur
Copy link
Contributor

The unrelated CI failures, would be fixed in #3269, please rebase onto latest main when it's merged

@Dev-CodeBox Dev-CodeBox force-pushed the add-hkts-tour-section branch from 19078bd to cf89591 Compare January 23, 2026 09:02
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