Skip to content

Conversation

@fabianhjr
Copy link

@fabianhjr fabianhjr commented Feb 11, 2023

As an excuse to better learn cats and scala 3 I started with an overhaul.

This is still a work in progress. (Checking by building sbt pdf)

TODOS:

(*) Unaddressed:

warning: custom-instances.md:254:43: 
pattern's type ::[repl.MdocSession.MdocApp4.Tree[B]] is more specialized than the right hand side expression's type List[repl.MdocSession.MdocApp4.Tree[B]]

If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
which may result in a MatchError at runtime.
              val left :: right :: tail = acc
                                          ^^^

@fabianhjr fabianhjr changed the title WIP: Scala3 Overhaul WIP: Scala 3 Overhaul Feb 11, 2023
@fabianhjr fabianhjr force-pushed the scala3-overhaul branch 3 times, most recently from 8c59bd3 to 1ac0036 Compare February 11, 2023 22:05
Comment on lines -38 to -44
val showInt = Show.apply[Int]
given showInt: Show[Int] = Show.apply[Int]
```

Oops---that didn't work!
The `apply` method uses *implicits* to look up individual instances,
so we'll have to bring some instances into scope.

Copy link
Author

Choose a reason for hiding this comment

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

Need to revise this,

if left as val showInt then Show.apply is left as a lamdba (unevaluated) and the output of mdoc didn't match the text.

If changed to given showInt then Show.apply uses showInt as a cyclic reference and succeeds (but warns on compilation about an infinite loop)

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.

1 participant