Skip to content

Commit

Permalink
Add contramap to Printable
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Oct 6, 2024
1 parent 22a86fb commit eca5bf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/print/anticipation.Printable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ object Printable:
trait Printable:
type Self
def print(text: Self, termcap: Termcap): Text

def contramap[SelfType](lambda: Termcap ?=> SelfType => Self): SelfType is Printable =
(self, termcap) => print(lambda(using termcap)(self), termcap)

0 comments on commit eca5bf0

Please sign in to comment.