Closed
Description
Compiler version
3.5.0
Minimized code
See for example
scala3/docs/_docs/reference/experimental/typeclasses.md
Lines 46 to 80 in 5101daf
or
scala3/docs/_docs/reference/experimental/typeclasses.md
Lines 135 to 144 in 5101daf
Output
Which is copied as:
trait Ord:
type Self
trait SemiGroup:
type Self
extension (x: Self) def combine(y: Self): Self
trait Monoid extends SemiGroup:
def unit: Self
object Monoid:
def unit[M](using m: Monoid { type Self = M}): M
trait Functor:
type Self[A]
extension [A](x: Self[A]) def map[B](f: A => B): Self[B]
trait Monad extends Functor:
def pure[A](x: A): Self[A]
extension [A](x: Self[A])
def flatMap[B](f: A => Self[B]): Self[B]
def map[B](f: A => B) = x.flatMap(f `andThen` pure)
def reduce[A: Monoid](xs: List[A]): A =
xs.foldLeft(Monoid.unit)(_ `combine` _)
trait ParserCombinator:
type Self
type Input
type Result
extension (self: Self)
def parse(input: Input): Option[Result] = ...
def combine[A: ParserCombinator, B: ParserCombinator { type Input = A.Input }] = ...
or
which is copied as
given Int is Ord ...
given Int is Monoid ...
type Reader = [X] =>> Env => X
given Reader is Monad ...
object Monoid:
def unit[M](using m: M is Monoid): M
Expectation
I would expect the code to show (and be copied) just as it was written in the markdown.
Either keep the indentation for all lines or remove the indentation from all lines by the same amount.